What is the exact meaning of 吃豆腐, and where does the expression come from?
I've only heard it used in describing sexual situations, and wiktionary.org describes its usage as follows:


  This idiom usually only refers to a man taking advantage of a woman in a sexual situation.


A typical example would be some creepy guy pinching the flight attendant's backside as she walks past.

There's also a good discussion at wordreference.com.


  不要吃我豆腐 is telling someone not to take advantage of me, but specifically in a sexual way, as in inappropriate touches etc. However, the accusation is not very serious in Chinese, and sometimes said in a joking manner. I would translate it as "Don't harasse me!", "Get your hands off me!" etc., but understand that the Chinese expression is softer.


I found an origin story on chinese-forums.com, but I'm not sure how reliable it is.


  It’s said that tofu shops usually were run by wife and husband in the old days. Female boss in a tofu shop took tofu as their daily food, which made their skin tender and smooth. On one hand their fine skin helped attract more customers, on the other hand it showed some kind of coquetry to them. Men liked to take “to eat tofu” as an excuse to go to a tofu shop and flirt with the female boss there, verbally or even physically. Therefore, wives, feeling jealous, scolded their husbands, “Today, you went to eat tofu again?!” Now, “eating tofu” has become a word to describe man flirts with woman.