diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/zoom/zoom_controller.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/ui/zoom/zoom_controller.cc b/chrome/browser/ui/zoom/zoom_controller.cc index 47381ee..9522eec 100644 --- a/chrome/browser/ui/zoom/zoom_controller.cc +++ b/chrome/browser/ui/zoom/zoom_controller.cc @@ -43,11 +43,17 @@ ZoomController::ZoomController(content::WebContents* web_contents) ZoomController::~ZoomController() {} bool ZoomController::IsAtDefaultZoom() const { + if (!web_contents()) + return true; + return content::ZoomValuesEqual(web_contents()->GetZoomLevel(), default_zoom_level_.GetValue()); } int ZoomController::GetResourceForZoomLevel() const { + if (!web_contents()) + return IDR_ZOOM_MINUS; + DCHECK(!IsAtDefaultZoom()); double zoom = web_contents()->GetZoomLevel(); return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; @@ -69,8 +75,10 @@ void ZoomController::Observe(int type, } void ZoomController::UpdateState(const std::string& host) { - // TODO(dbeam): figure out why web_contents() is NULL sometimes. - // http://crbug.com/144879 + // TODO(dbeam): I'm not totally sure why this is happening, and there's been a + // bit of effort to understand with no tangible results yet. It's possible + // that WebContents is NULL as it's being destroyed or some other random + // reason that I haven't found yet. Applying band-aid. http://crbug.com/144879 if (!web_contents()) return; |