OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 #endif | 762 #endif |
763 | 763 |
764 gcm::PushMessagingServiceImpl::InitializeForProfile(this); | 764 gcm::PushMessagingServiceImpl::InitializeForProfile(this); |
765 | 765 |
766 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_IOS) | 766 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_IOS) |
767 signin_ui_util::InitializePrefsForProfile(this); | 767 signin_ui_util::InitializePrefsForProfile(this); |
768 #endif | 768 #endif |
769 } | 769 } |
770 | 770 |
771 void ProfileImpl::InitHostZoomMap() { | 771 void ProfileImpl::InitHostZoomMap() { |
772 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); | 772 HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this); |
773 host_zoom_map->SetDefaultZoomLevel( | 773 host_zoom_map->SetDefaultZoomLevel( |
774 prefs_->GetDouble(prefs::kDefaultZoomLevel)); | 774 prefs_->GetDouble(prefs::kDefaultZoomLevel)); |
775 | 775 |
776 const base::DictionaryValue* host_zoom_dictionary = | 776 const base::DictionaryValue* host_zoom_dictionary = |
777 prefs_->GetDictionary(prefs::kPerHostZoomLevels); | 777 prefs_->GetDictionary(prefs::kPerHostZoomLevels); |
778 // Careful: The returned value could be NULL if the pref has never been set. | 778 // Careful: The returned value could be NULL if the pref has never been set. |
779 if (host_zoom_dictionary != NULL) { | 779 if (host_zoom_dictionary != NULL) { |
780 std::vector<std::string> keys_to_remove; | 780 std::vector<std::string> keys_to_remove; |
781 for (base::DictionaryValue::Iterator i(*host_zoom_dictionary); !i.IsAtEnd(); | 781 for (base::DictionaryValue::Iterator i(*host_zoom_dictionary); !i.IsAtEnd(); |
782 i.Advance()) { | 782 i.Advance()) { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 this, GetPath().Append(chrome::kTopSitesFilename)); | 1178 this, GetPath().Append(chrome::kTopSitesFilename)); |
1179 } | 1179 } |
1180 return top_sites_.get(); | 1180 return top_sites_.get(); |
1181 } | 1181 } |
1182 | 1182 |
1183 history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { | 1183 history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { |
1184 return top_sites_.get(); | 1184 return top_sites_.get(); |
1185 } | 1185 } |
1186 | 1186 |
1187 void ProfileImpl::OnDefaultZoomLevelChanged() { | 1187 void ProfileImpl::OnDefaultZoomLevelChanged() { |
1188 HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel( | 1188 HostZoomMap::GetDefaultForBrowserContext(this)->SetDefaultZoomLevel( |
1189 pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel)); | 1189 pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel)); |
1190 } | 1190 } |
1191 | 1191 |
1192 void ProfileImpl::OnZoomLevelChanged( | 1192 void ProfileImpl::OnZoomLevelChanged( |
1193 const HostZoomMap::ZoomLevelChange& change) { | 1193 const HostZoomMap::ZoomLevelChange& change) { |
1194 | 1194 |
1195 if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST) | 1195 if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST) |
1196 return; | 1196 return; |
1197 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); | 1197 HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this); |
1198 double level = change.zoom_level; | 1198 double level = change.zoom_level; |
1199 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); | 1199 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); |
1200 base::DictionaryValue* host_zoom_dictionary = update.Get(); | 1200 base::DictionaryValue* host_zoom_dictionary = update.Get(); |
1201 if (content::ZoomValuesEqual(level, host_zoom_map->GetDefaultZoomLevel())) | 1201 if (content::ZoomValuesEqual(level, host_zoom_map->GetDefaultZoomLevel())) |
1202 host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, NULL); | 1202 host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, NULL); |
1203 else | 1203 else |
1204 host_zoom_dictionary->SetDoubleWithoutPathExpansion(change.host, level); | 1204 host_zoom_dictionary->SetDoubleWithoutPathExpansion(change.host, level); |
1205 } | 1205 } |
1206 | 1206 |
1207 #if defined(ENABLE_SESSION_SERVICE) | 1207 #if defined(ENABLE_SESSION_SERVICE) |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1455 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1456 GetForBrowserContext(this); | 1456 GetForBrowserContext(this); |
1457 if (!service) | 1457 if (!service) |
1458 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1458 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1459 | 1459 |
1460 return service->CreateMonitor( | 1460 return service->CreateMonitor( |
1461 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 1461 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
1462 local_state, | 1462 local_state, |
1463 prefs::kMetricsReportingEnabled); | 1463 prefs::kMetricsReportingEnabled); |
1464 } | 1464 } |
OLD | NEW |