Index: chrome/browser/profiles/off_the_record_profile_impl.cc |
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc |
index 489c2aec63836e5c08735aabc07ae084d1f52ff8..7b7aa37bc302b28968c94c5f7319710f21e9e76e 100644 |
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc |
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc |
@@ -45,8 +45,6 @@ |
#include "chrome/common/render_messages.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/host_zoom_map.h" |
-#include "content/public/browser/notification_service.h" |
-#include "content/public/browser/notification_types.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/storage_partition.h" |
#include "content/public/browser/web_contents.h" |
@@ -129,6 +127,10 @@ void OffTheRecordProfileImpl::Init() { |
OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { |
MaybeSendDestroyedNotification(); |
+ HostZoomMap::GetForBrowserContext(profile_)->RemoveZoomLevelChangedCallback( |
+ base::Bind(&OffTheRecordProfileImpl::OnZoomLevelChanged, |
+ base::Unretained(this))); |
+ |
#if defined(ENABLE_PLUGINS) |
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
io_data_.GetResourceContextNoInit()); |
@@ -165,8 +167,9 @@ void OffTheRecordProfileImpl::InitHostZoomMap() { |
host_zoom_map->CopyFrom(parent_host_zoom_map); |
// Observe parent's HZM change for propagating change of parent's |
// change to this HZM. |
- registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, |
- content::Source<HostZoomMap>(parent_host_zoom_map)); |
+ parent_host_zoom_map->AddZoomLevelChangedCallback( |
+ base::Bind(&OffTheRecordProfileImpl::OnZoomLevelChanged, |
+ base::Unretained(this))); |
} |
#if defined(OS_ANDROID) |
@@ -428,21 +431,15 @@ GURL OffTheRecordProfileImpl::GetHomePage() { |
return profile_->GetHomePage(); |
} |
-void OffTheRecordProfileImpl::Observe( |
- int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { |
- const std::string& host = |
- *(content::Details<const std::string>(details).ptr()); |
- if (!host.empty()) { |
- HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
- HostZoomMap* parent_host_zoom_map = |
- HostZoomMap::GetForBrowserContext(profile_); |
- double level = parent_host_zoom_map->GetZoomLevel(host); |
- host_zoom_map->SetZoomLevel(host, level); |
- } |
- } |
+void OffTheRecordProfileImpl::OnZoomLevelChanged(const std::string& host) { |
+ if (host.empty()) |
+ return; |
+ |
+ HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
+ HostZoomMap* parent_host_zoom_map = |
+ HostZoomMap::GetForBrowserContext(profile_); |
+ double level = parent_host_zoom_map->GetZoomLevel(host); |
+ host_zoom_map->SetZoomLevel(host, level); |
} |
#if defined(OS_CHROMEOS) |