There are many factors to consider.
First, the constituency of the surface. If the ground is made of dirt, grass, or other naturally occurring biological material, I won't eat off of it. To a lesser extent, same goes for particularly shaggy carpets. However, if the surface is a single solid surface, like tile, wood, stone, and concrete, I am willing to eat of it. This includes sidewalks, but I'll usually check to make sure no grit carried over—if so, I can just brush it off. The exception, of course, is public restrooms and hallways with known mouse or rat infestations.
Second, the constituency of the food. Liquids and semi-liquids, like jello, will not be tolerated from anything lower than a chair-seat. Icecream and the like must be rinsed of the afflicted area—and has no tolerance for sidewalks or other public surfaces. Things with a crumbly exterior can simply be brushed off. Anything firmer than chocolate is typically safe. Anything with a peel, edible or not—like apples—breaks many of the surface rules, as I'll eat it off dirt or grass after brushing it off.
Third, the company I keep. For friends and close family, anything goes. In non-formal situations, the same goes for high-school teachers, classmates, and coworkers. With extended family and acquaintances, I will only eat off of indoor surfaces. In a formal setting, no tolerance allowed.
Fourth, and last, it depends on how attached I actually am to the food.
In general, I eat a lot of food off the ground. However, I absolutely despise eating food or drink that others have already started. For that reason, I also obviously never eat found food.