Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/ui/zoom/zoom_controller.cc

Issue 11359205: [zoom bubble] First part of speculative fix for zoom bubble crashes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« chrome/browser/ui/zoom/OWNERS ('K') | « chrome/browser/ui/zoom/OWNERS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/zoom/zoom_controller.h" 5 #include "chrome/browser/ui/zoom/zoom_controller.h"
6 6
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void ZoomController::OnPreferenceChanged(PrefServiceBase* service, 72 void ZoomController::OnPreferenceChanged(PrefServiceBase* service,
73 const std::string& pref_name) { 73 const std::string& pref_name) {
74 DCHECK(pref_name == prefs::kDefaultZoomLevel); 74 DCHECK(pref_name == prefs::kDefaultZoomLevel);
75 UpdateState(std::string()); 75 UpdateState(std::string());
76 } 76 }
77 77
78 void ZoomController::UpdateState(const std::string& host) { 78 void ZoomController::UpdateState(const std::string& host) {
79 if (host.empty()) 79 if (host.empty())
80 return; 80 return;
81 81
82 CHECK(web_contents()); // http://crbug.com/144879
83
82 // Use the active navigation entry's URL instead of the WebContents' so 84 // Use the active navigation entry's URL instead of the WebContents' so
83 // virtual URLs work (e.g. chrome://settings). http://crbug.com/153950 85 // virtual URLs work (e.g. chrome://settings). http://crbug.com/153950
84 content::NavigationEntry* active_entry = 86 content::NavigationEntry* active_entry =
85 web_contents()->GetController().GetActiveEntry(); 87 web_contents()->GetController().GetActiveEntry();
86 if (!active_entry || 88 if (!active_entry ||
87 host != net::GetHostOrSpecFromURL(active_entry->GetURL())) { 89 host != net::GetHostOrSpecFromURL(active_entry->GetURL())) {
88 return; 90 return;
89 } 91 }
90 92
91 bool dummy; 93 bool dummy;
92 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); 94 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy);
93 95
94 if (observer_) 96 if (observer_)
95 observer_->OnZoomChanged(web_contents(), !host.empty()); 97 observer_->OnZoomChanged(web_contents(), !host.empty());
96 } 98 }
OLDNEW
« chrome/browser/ui/zoom/OWNERS ('K') | « chrome/browser/ui/zoom/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698