Index: chrome/browser/ui/zoom/zoom_controller.cc |
diff --git a/chrome/browser/ui/zoom/zoom_controller.cc b/chrome/browser/ui/zoom/zoom_controller.cc |
index 24b33baad649d27d4287532503a79d6d1ad08c83..5b5430637731c8c43043acf6fe2432cee7031d10 100644 |
--- a/chrome/browser/ui/zoom/zoom_controller.cc |
+++ b/chrome/browser/ui/zoom/zoom_controller.cc |
@@ -22,7 +22,9 @@ |
DEFINE_WEB_CONTENTS_USER_DATA_KEY(ZoomController); |
ZoomController::ZoomController(content::WebContents* web_contents) |
- : content::WebContentsObserver(web_contents), |
+ : content::HostZoomMap::Observer(content::HostZoomMap::GetForBrowserContext( |
+ web_contents->GetBrowserContext())), |
+ content::WebContentsObserver(web_contents), |
zoom_percent_(100), |
observer_(NULL) { |
Profile* profile = |
@@ -32,11 +34,6 @@ ZoomController::ZoomController(content::WebContents* web_contents) |
base::Unretained(this), |
std::string())); |
- content::HostZoomMap* zoom_map = |
- content::HostZoomMap::GetForBrowserContext(profile); |
- registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, |
- content::Source<content::HostZoomMap>(zoom_map)); |
- |
UpdateState(std::string()); |
} |
@@ -59,6 +56,10 @@ int ZoomController::GetResourceForZoomLevel() const { |
return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; |
} |
+void ZoomController::OnZoomLevelChanged(const std::string& host) { |
+ UpdateState(host); |
+} |
+ |
void ZoomController::DidNavigateMainFrame( |
const content::LoadCommittedDetails& details, |
const content::FrameNavigateParams& params) { |
@@ -67,13 +68,6 @@ void ZoomController::DidNavigateMainFrame( |
UpdateState(std::string()); |
} |
-void ZoomController::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- DCHECK_EQ(content::NOTIFICATION_ZOOM_LEVEL_CHANGED, type); |
- UpdateState(*content::Details<std::string>(details).ptr()); |
-} |
- |
void ZoomController::UpdateState(const std::string& host) { |
// 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 |