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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 7067005: Remove Profile code from HostZoomMap. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/browser/ui/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "chrome/browser/net/net_pref_observer.h" 45 #include "chrome/browser/net/net_pref_observer.h"
46 #include "chrome/browser/net/pref_proxy_config_service.h" 46 #include "chrome/browser/net/pref_proxy_config_service.h"
47 #include "chrome/browser/net/ssl_config_service_manager.h" 47 #include "chrome/browser/net/ssl_config_service_manager.h"
48 #include "chrome/browser/password_manager/password_store_default.h" 48 #include "chrome/browser/password_manager/password_store_default.h"
49 #include "chrome/browser/policy/configuration_policy_pref_store.h" 49 #include "chrome/browser/policy/configuration_policy_pref_store.h"
50 #include "chrome/browser/policy/configuration_policy_provider.h" 50 #include "chrome/browser/policy/configuration_policy_provider.h"
51 #include "chrome/browser/policy/profile_policy_connector.h" 51 #include "chrome/browser/policy/profile_policy_connector.h"
52 #include "chrome/browser/policy/profile_policy_connector_factory.h" 52 #include "chrome/browser/policy/profile_policy_connector_factory.h"
53 #include "chrome/browser/prefs/browser_prefs.h" 53 #include "chrome/browser/prefs/browser_prefs.h"
54 #include "chrome/browser/prefs/pref_value_store.h" 54 #include "chrome/browser/prefs/pref_value_store.h"
55 #include "chrome/browser/prefs/scoped_user_pref_update.h"
55 #include "chrome/browser/prerender/prerender_manager.h" 56 #include "chrome/browser/prerender/prerender_manager.h"
56 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 57 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
57 #include "chrome/browser/profiles/profile_dependency_manager.h" 58 #include "chrome/browser/profiles/profile_dependency_manager.h"
58 #include "chrome/browser/profiles/profile_manager.h" 59 #include "chrome/browser/profiles/profile_manager.h"
59 #include "chrome/browser/search_engines/template_url_fetcher.h" 60 #include "chrome/browser/search_engines/template_url_fetcher.h"
60 #include "chrome/browser/search_engines/template_url_model.h" 61 #include "chrome/browser/search_engines/template_url_model.h"
61 #include "chrome/browser/sessions/session_service_factory.h" 62 #include "chrome/browser/sessions/session_service_factory.h"
62 #include "chrome/browser/spellcheck_host.h" 63 #include "chrome/browser/spellcheck_host.h"
63 #include "chrome/browser/ssl/ssl_host_state.h" 64 #include "chrome/browser/ssl/ssl_host_state.h"
64 #include "chrome/browser/status_icons/status_tray.h" 65 #include "chrome/browser/status_icons/status_tray.h"
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 941 }
941 942
942 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { 943 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() {
943 if (!host_content_settings_map_.get()) 944 if (!host_content_settings_map_.get())
944 host_content_settings_map_ = new HostContentSettingsMap(this); 945 host_content_settings_map_ = new HostContentSettingsMap(this);
945 return host_content_settings_map_.get(); 946 return host_content_settings_map_.get();
946 } 947 }
947 948
948 HostZoomMap* ProfileImpl::GetHostZoomMap() { 949 HostZoomMap* ProfileImpl::GetHostZoomMap() {
949 if (!host_zoom_map_) { 950 if (!host_zoom_map_) {
950 host_zoom_map_ = new HostZoomMap(this); 951 host_zoom_map_ = new HostZoomMap();
951 host_zoom_map_->set_default_zoom_level( 952 host_zoom_map_->set_default_zoom_level(
952 GetPrefs()->GetDouble(prefs::kDefaultZoomLevel)); 953 GetPrefs()->GetDouble(prefs::kDefaultZoomLevel));
954
955 const DictionaryValue* host_zoom_dictionary =
956 prefs_->GetDictionary(prefs::kPerHostZoomLevels);
957 // Careful: The returned value could be NULL if the pref has never been set.
958 if (host_zoom_dictionary != NULL) {
959 for (DictionaryValue::key_iterator i(host_zoom_dictionary->begin_keys());
960 i != host_zoom_dictionary->end_keys(); ++i) {
961 const std::string& host(*i);
962 double zoom_level = 0;
963
964 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion(
965 host, &zoom_level);
966 DCHECK(success);
967 host_zoom_map_->SetZoomLevel(GURL(host), zoom_level);
968 }
969 }
970
971 registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED,
972 Source<HostZoomMap>(host_zoom_map_));
953 } 973 }
954 return host_zoom_map_.get(); 974 return host_zoom_map_.get();
955 } 975 }
956 976
957 GeolocationContentSettingsMap* ProfileImpl::GetGeolocationContentSettingsMap() { 977 GeolocationContentSettingsMap* ProfileImpl::GetGeolocationContentSettingsMap() {
958 if (!geolocation_content_settings_map_.get()) 978 if (!geolocation_content_settings_map_.get())
959 geolocation_content_settings_map_ = new GeolocationContentSettingsMap(this); 979 geolocation_content_settings_map_ = new GeolocationContentSettingsMap(this);
960 return geolocation_content_settings_map_.get(); 980 return geolocation_content_settings_map_.get();
961 } 981 }
962 982
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 GetHostZoomMap()->set_default_zoom_level( 1387 GetHostZoomMap()->set_default_zoom_level(
1368 prefs->GetDouble(prefs::kDefaultZoomLevel)); 1388 prefs->GetDouble(prefs::kDefaultZoomLevel));
1369 } 1389 }
1370 break; 1390 break;
1371 } 1391 }
1372 case NotificationType::BOOKMARK_MODEL_LOADED: 1392 case NotificationType::BOOKMARK_MODEL_LOADED:
1373 GetProfileSyncService(); // Causes lazy-load if sync is enabled. 1393 GetProfileSyncService(); // Causes lazy-load if sync is enabled.
1374 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, 1394 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED,
1375 Source<Profile>(this)); 1395 Source<Profile>(this));
1376 break; 1396 break;
1397 case NotificationType::ZOOM_LEVEL_CHANGED: {
1398 const std::string& host = *(Details<const std::string>(details).ptr());
1399 if (!host.empty()) {
1400 double level = host_zoom_map_->GetZoomLevel(GURL(host));
1401 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
1402 DictionaryValue* host_zoom_dictionary = update.Get();
1403 if (level == host_zoom_map_->default_zoom_level()) {
1404 host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL);
1405 } else {
1406 host_zoom_dictionary->SetWithoutPathExpansion(
1407 host, Value::CreateDoubleValue(level));
1408 }
1409 }
1410 break;
1411 }
1377 default: 1412 default:
1378 NOTREACHED(); 1413 NOTREACHED();
1379 } 1414 }
1380 } 1415 }
1381 1416
1382 void ProfileImpl::StopCreateSessionServiceTimer() { 1417 void ProfileImpl::StopCreateSessionServiceTimer() {
1383 create_session_service_timer_.Stop(); 1418 create_session_service_timer_.Stop();
1384 } 1419 }
1385 1420
1386 void ProfileImpl::EnsureSessionServiceCreated() { 1421 void ProfileImpl::EnsureSessionServiceCreated() {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 return pref_proxy_config_tracker_; 1627 return pref_proxy_config_tracker_;
1593 } 1628 }
1594 1629
1595 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { 1630 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() {
1596 if (!prerender::PrerenderManager::IsPrerenderingPossible()) 1631 if (!prerender::PrerenderManager::IsPrerenderingPossible())
1597 return NULL; 1632 return NULL;
1598 if (!prerender_manager_.get()) 1633 if (!prerender_manager_.get())
1599 prerender_manager_.reset(new prerender::PrerenderManager(this)); 1634 prerender_manager_.reset(new prerender::PrerenderManager(this));
1600 return prerender_manager_.get(); 1635 return prerender_manager_.get();
1601 } 1636 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/browser/ui/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698