summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-22 01:58:14 +0000
committerdbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-22 01:58:14 +0000
commitad65e6b83eb295f4499fcbd299ade2815e05893f (patch)
treeff17d105e2430d2c7ede829e8bb0045afe351d1e /chrome/browser
parent564f22339e42cfafcf6a5b0a60934c46361f7abf (diff)
downloadchromium_src-ad65e6b83eb295f4499fcbd299ade2815e05893f.zip
chromium_src-ad65e6b83eb295f4499fcbd299ade2815e05893f.tar.gz
chromium_src-ad65e6b83eb295f4499fcbd299ade2815e05893f.tar.bz2
[zoom bubble] More prospective crash fixes via more null guarding.
R=avi@chromium.org,thestig@chromium.org BUG=144879 Review URL: https://chromiumcodereview.appspot.com/11416125 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/ui/zoom/zoom_controller.cc12
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;