I thought pneumonia and bronchitis were either bacterial or viral.
That is correct.
Well, they usually are caused by a bacterial or viral infection, but the condition itself is inflammation which can be caused by a lot of things, e.g. chemicals:
Chemical pneumonia is an unusual type of lung irritation. Pneumonia usually is caused by a bacteria or virus. In chemical pneumonia, inflammation of lung tissue is from poisons or toxins. Only a small percentage of pneumonias are caused by chemicals.
* Many substances can cause chemical pneumonia, including liquids, gases, and small particles, such as dust or fumes, also called particulate matter. Some chemicals only harm the lungs; however, some toxic materials affect other organs in addition to the lungs and can result in serious organ damage or death.
http://www.emedicinehealth.com/articles/17689-1.asp