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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl_unittest.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
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
===================================================================
--- chrome/browser/profiles/off_the_record_profile_impl_unittest.cc (revision 122827)
+++ chrome/browser/profiles/off_the_record_profile_impl_unittest.cc (working copy)
@@ -24,20 +24,14 @@
class TestingProfileWithHostZoomMap : public TestingProfile,
public content::NotificationObserver {
public:
- TestingProfileWithHostZoomMap() {}
+ TestingProfileWithHostZoomMap() {
+ HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
+ registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
+ content::Source<HostZoomMap>(host_zoom_map));
+ }
virtual ~TestingProfileWithHostZoomMap() {}
- virtual HostZoomMap* GetHostZoomMap() {
- if (!host_zoom_map_) {
- host_zoom_map_ = HostZoomMap::Create();
-
- registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
- content::Source<HostZoomMap>(host_zoom_map_));
- }
- return host_zoom_map_.get();
- }
-
virtual Profile* GetOffTheRecordProfile() OVERRIDE {
if (!off_the_record_profile_.get())
off_the_record_profile_.reset(CreateOffTheRecordProfile());
@@ -57,10 +51,11 @@
if (host.empty())
return;
- double level = host_zoom_map_->GetZoomLevel(host);
+ HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
+ double level = host_zoom_map->GetZoomLevel(host);
DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
DictionaryValue* host_zoom_dictionary = update.Get();
- if (level == host_zoom_map_->GetDefaultZoomLevel()) {
+ if (level == host_zoom_map->GetDefaultZoomLevel()) {
host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL);
} else {
host_zoom_dictionary->SetWithoutPathExpansion(
@@ -70,7 +65,6 @@
private:
content::NotificationRegistrar registrar_;
- scoped_refptr<HostZoomMap> host_zoom_map_;
scoped_ptr<Profile> off_the_record_profile_;
scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;
@@ -133,7 +127,8 @@
ASSERT_TRUE(parent_profile->GetOffTheRecordPrefs());
// Prepare parent host zoom map.
- HostZoomMap* parent_zoom_map = parent_profile->GetHostZoomMap();
+ HostZoomMap* parent_zoom_map =
+ HostZoomMap::GetForBrowserContext(parent_profile.get());
ASSERT_TRUE(parent_zoom_map);
parent_zoom_map->SetZoomLevel(host, zoom_level_25);
@@ -143,11 +138,13 @@
// NOTIFICATION_ZOOM_LEVEL_CHANGED.
// Prepare child profile as off the record profile.
- scoped_ptr<Profile> child_profile(
+ scoped_ptr<OffTheRecordProfileImpl> child_profile(
new OffTheRecordProfileImpl(parent_profile.get()));
+ child_profile->InitHostZoomMap();
// Prepare child host zoom map.
- HostZoomMap* child_zoom_map = child_profile->GetHostZoomMap();
+ HostZoomMap* child_zoom_map =
+ HostZoomMap::GetForBrowserContext(child_profile.get());
ASSERT_TRUE(child_zoom_map);
// Verity.
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698