Index: chrome/browser/profiles/profile_impl.cc |
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
index 14248d60b65bfbd9293d9652ae4f0876484acce0..248b75091bb6976069db704068fde6bf89aff0f3 100644 |
--- a/chrome/browser/profiles/profile_impl.cc |
+++ b/chrome/browser/profiles/profile_impl.cc |
@@ -72,6 +72,7 @@ |
#include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
#include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
#include "chrome/browser/ui/startup/startup_browser_creator.h" |
+#include "chrome/browser/ui/zoom/zoom_level_prefs_store_impl.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_paths_internal.h" |
#include "chrome/common/chrome_switches.h" |
@@ -627,12 +628,11 @@ void ProfileImpl::DoFinalInit() { |
session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
} |
- InitHostZoomMap(); |
- |
base::Callback<void(bool)> data_reduction_proxy_unavailable; |
scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
data_reduction_proxy_params; |
scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; |
+ |
#if defined(SPDY_PROXY_AUTH_ORIGIN) |
DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = |
DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); |
@@ -736,53 +736,6 @@ void ProfileImpl::DoFinalInit() { |
gcm::PushMessagingServiceImpl::InitializeForProfile(this); |
} |
-void ProfileImpl::InitHostZoomMap() { |
- HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
- host_zoom_map->SetDefaultZoomLevel( |
- prefs_->GetDouble(prefs::kDefaultZoomLevel)); |
- |
- const base::DictionaryValue* host_zoom_dictionary = |
- prefs_->GetDictionary(prefs::kPerHostZoomLevels); |
- // Careful: The returned value could be NULL if the pref has never been set. |
- if (host_zoom_dictionary != NULL) { |
- std::vector<std::string> keys_to_remove; |
- for (base::DictionaryValue::Iterator i(*host_zoom_dictionary); !i.IsAtEnd(); |
- i.Advance()) { |
- const std::string& host(i.key()); |
- double zoom_level = 0; |
- |
- bool success = i.value().GetAsDouble(&zoom_level); |
- DCHECK(success); |
- |
- // Filter out A) the empty host, B) zoom levels equal to the default; and |
- // remember them, so that we can later erase them from Prefs. |
- // Values of type A and B could have been stored due to crbug.com/364399. |
- // Values of type B could further have been stored before the default zoom |
- // level was set to its current value. In either case, SetZoomLevelForHost |
- // will ignore type B values, thus, to have consistency with HostZoomMap's |
- // internal state, these values must also be removed from Prefs. |
- if (host.empty() || |
- content::ZoomValuesEqual(zoom_level, |
- host_zoom_map->GetDefaultZoomLevel())) { |
- keys_to_remove.push_back(host); |
- continue; |
- } |
- |
- host_zoom_map->SetZoomLevelForHost(host, zoom_level); |
- } |
- |
- DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); |
- base::DictionaryValue* host_zoom_dictionary = update.Get(); |
- for (std::vector<std::string>::const_iterator it = keys_to_remove.begin(); |
- it != keys_to_remove.end(); ++it) { |
- host_zoom_dictionary->RemoveWithoutPathExpansion(*it, NULL); |
- } |
- } |
- |
- zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback( |
- base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this))); |
-} |
- |
base::FilePath ProfileImpl::last_selected_directory() { |
return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
} |
@@ -845,6 +798,16 @@ Profile::ProfileType ProfileImpl::GetProfileType() const { |
return REGULAR_PROFILE; |
} |
+double ProfileImpl::GetDefaultZoomLevel() const { |
+ return pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel); |
+} |
+ |
+scoped_ptr<content::ZoomLevelPrefsStore> |
+ProfileImpl::CreateZoomLevelPrefsStore() { |
+ return scoped_ptr<content::ZoomLevelPrefsStore>( |
+ new browser::ZoomLevelPrefsStoreImpl); |
+} |
+ |
base::FilePath ProfileImpl::GetPath() const { |
return path_; |
} |
@@ -1153,8 +1116,7 @@ history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { |
} |
void ProfileImpl::OnDefaultZoomLevelChanged() { |
- HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel( |
- pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel)); |
+ BrowserContext::SetDefaultZoomLevel(this, GetDefaultZoomLevel()); |
} |
void ProfileImpl::OnZoomLevelChanged( |
@@ -1162,11 +1124,10 @@ void ProfileImpl::OnZoomLevelChanged( |
if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST) |
return; |
- HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
double level = change.zoom_level; |
DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); |
base::DictionaryValue* host_zoom_dictionary = update.Get(); |
- if (content::ZoomValuesEqual(level, host_zoom_map->GetDefaultZoomLevel())) |
+ if (content::ZoomValuesEqual(level, GetDefaultZoomLevel())) |
host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, NULL); |
else |
host_zoom_dictionary->SetDoubleWithoutPathExpansion(change.host, level); |