I wouldn't even worry about the black bear. They are harmless unless you provoke them or are carrying food in a backpack or the like.
A grizzly on the other hand is a very different story. I'll agree with taking a BIG can of spray. A pistol is not going to do anything. If I had a choice and I knew my life was on the line, I would rather have a can of spray in my hand than anything less than a large bore rifle or shotgun. The noise MAY scare them away, the spray WILL have an affect and will possibly turn them away, that is of course if you have enough.
With that said, I don't go in the backcountry out west without a pistol.