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

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: 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)
@@ -83,6 +83,15 @@
prefs_(real_profile->GetOffTheRecordPrefs()),
ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)),
start_time_(Time::Now()) {
+ // Create new host zoom map and copy zoom levels from parent.
+ 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));
}
void OffTheRecordProfileImpl::Init() {
@@ -345,19 +354,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();
@@ -507,8 +503,11 @@
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