Electric fences are a thing to keep bears out. I've spent a couple of winters in a neighborhood in Homewood, CA where at least half the homes have them. If they do get in, there's nothing quite like a bear to force you into an unplanned kitchen remodel.
The problem is (in Yosemite anyway), the bears have learned what goes into an ice chest and can easily pop out a partially opened window. The Park wants you to use the bear boxes but as a minimum I always cover anything that looks like food or an ice chest. I lock the doors, block out the windows and keep the top down when away from camp. I could be wrong but I doubt the rangers would be too happy seeing an ice chest left outside even if it's a locked bear proof type. Several years back I watched a bear sneak up on a guy & go medieval on his ice chest... kind of looked like a soccer game. Damn things will quietly walk up behind you if you're not paying attention
__________________
2006 Ford 6.0PSD EB-50/E-PH SMB 4X4 Rock Crawler Trailer
Camping at Assateaque Island National Seashore last year I watched a few wild horses walk right up to a family making smores at a campfire and literally chase off the humans and then eat the food. They are as bad as the bears in Yosemite!