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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 9416070: Move creation and ownership of HostZoomMap to content instead of having every embedder do this. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac/cros browsertests Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/off_the_record_profile_impl.cc
===================================================================
--- chrome/browser/profiles/off_the_record_profile_impl.cc (revision 122827)
+++ chrome/browser/profiles/off_the_record_profile_impl.cc (working copy)
@@ -103,6 +103,8 @@
GetRequestContext();
#endif // defined(OS_CHROMEOS)
+ InitHostZoomMap();
+
// Make the chrome//extension-icon/ resource available.
ExtensionIconSource* icon_source = new ExtensionIconSource(profile_);
GetChromeURLDataManager()->AddDataSource(icon_source);
@@ -148,6 +150,17 @@
g_browser_process->io_thread()->ChangedToOnTheRecord();
}
+void OffTheRecordProfileImpl::InitHostZoomMap() {
+ HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
+ HostZoomMap* parent_host_zoom_map =
+ HostZoomMap::GetForBrowserContext(profile_);
+ 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));
+}
+
std::string OffTheRecordProfileImpl::GetProfileName() {
// Incognito profile should not return the profile name.
return std::string();
@@ -345,19 +358,6 @@
return host_content_settings_map_.get();
}
-HostZoomMap* OffTheRecordProfileImpl::GetHostZoomMap() {
- // Create new host zoom map and copy zoom levels from parent.
- if (!host_zoom_map_) {
- host_zoom_map_ = HostZoomMap::Create();
- host_zoom_map_->CopyFrom(profile_->GetHostZoomMap());
- // 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>(profile_->GetHostZoomMap()));
- }
- return host_zoom_map_.get();
-}
-
content::GeolocationPermissionContext*
OffTheRecordProfileImpl::GetGeolocationPermissionContext() {
return profile_->GetGeolocationPermissionContext();
@@ -500,15 +500,19 @@
return profile_->GetHomePage();
}
-void OffTheRecordProfileImpl::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+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()) {
- double level = profile_->GetHostZoomMap()->GetZoomLevel(host);
- GetHostZoomMap()->SetZoomLevel(host, level);
+ 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);
}
}
}
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.h ('k') | chrome/browser/profiles/off_the_record_profile_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698