From this site:
The bracha one recites over a pleasant fragrance depends on its source. If the fragrance comes from a produce that is fit to eat, whether it’s the fruit of a tree or of the ground, even if the fruit is unfit to eat on its own like a lemon, nevertheless since its primary purpose is to be eaten, the bracha is “haNosein reiach tov b’peiros,” that G-d places a pleasing smell in the fruit. (Mishnah Brurah 216:9 favors the alternate text, “asher nasan reiach tov b’peiros,” in the past tense.) One only says the bracha if he intended to smell the fruit. If he meant to eat it and smelled it incidentally, one does not recite a bracha. One says this bracha when enjoying the scent of roasted coffee beans.
Does this blessing apply only when smelling the actual fruit or would it apply to smelling vapors that may be mixed with other items or during a cooking process? Some examples - Should you say this bracha when:
Entering a Starbucks (well, technically, any coffee shop or even your kitchen), you are smelling the coffee as it's being brewed. I.e., you are most likely smelling the coffee vapor / steam, rather than the coffee fruit, itself.
The smell of beer comes from the vapors emitted during the brewing process. Beer vapors probably have a mix of alcohol from the yeasts (not considered a fruit, AFAIK) as well as hops and barley, which are fruits / veg. Should you say the bracha when in a microbrewery?
Smelling fried onions, French fries, sautéed garlic, etc.
Coffee while it is being roasted (if you're far away enough from the smoke)