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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // Careful: The returned value could be NULL if the pref has never been set. | 578 // Careful: The returned value could be NULL if the pref has never been set. |
579 if (host_zoom_dictionary != NULL) { | 579 if (host_zoom_dictionary != NULL) { |
580 for (DictionaryValue::key_iterator i(host_zoom_dictionary->begin_keys()); | 580 for (DictionaryValue::key_iterator i(host_zoom_dictionary->begin_keys()); |
581 i != host_zoom_dictionary->end_keys(); ++i) { | 581 i != host_zoom_dictionary->end_keys(); ++i) { |
582 const std::string& host(*i); | 582 const std::string& host(*i); |
583 double zoom_level = 0; | 583 double zoom_level = 0; |
584 | 584 |
585 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( | 585 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( |
586 host, &zoom_level); | 586 host, &zoom_level); |
587 DCHECK(success); | 587 DCHECK(success); |
588 host_zoom_map->SetZoomLevel(host, zoom_level); | 588 host_zoom_map->SetZoomLevelForHost(host, zoom_level); |
589 } | 589 } |
590 } | 590 } |
591 | 591 |
592 host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); | 592 host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); |
593 } | 593 } |
594 | 594 |
595 base::FilePath ProfileImpl::last_selected_directory() { | 595 base::FilePath ProfileImpl::last_selected_directory() { |
596 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 596 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
597 } | 597 } |
598 | 598 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 | 974 |
975 history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { | 975 history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { |
976 return top_sites_; | 976 return top_sites_; |
977 } | 977 } |
978 | 978 |
979 void ProfileImpl::OnDefaultZoomLevelChanged() { | 979 void ProfileImpl::OnDefaultZoomLevelChanged() { |
980 HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel( | 980 HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel( |
981 pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel)); | 981 pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel)); |
982 } | 982 } |
983 | 983 |
984 void ProfileImpl::OnZoomLevelChanged(const std::string& host) { | 984 void ProfileImpl::OnZoomLevelChanged( |
985 if (host.empty()) | 985 const HostZoomMap::ZoomLevelChange& change) { |
| 986 |
| 987 if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST) |
986 return; | 988 return; |
987 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); | 989 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
988 double level = host_zoom_map->GetZoomLevel(host); | 990 double level = change.zoom_level; |
989 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); | 991 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); |
990 DictionaryValue* host_zoom_dictionary = update.Get(); | 992 DictionaryValue* host_zoom_dictionary = update.Get(); |
991 if (level == host_zoom_map->GetDefaultZoomLevel()) { | 993 if (level == host_zoom_map->GetDefaultZoomLevel()) { |
992 host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL); | 994 host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, NULL); |
993 } else { | 995 } else { |
994 host_zoom_dictionary->SetWithoutPathExpansion( | 996 host_zoom_dictionary->SetWithoutPathExpansion( |
995 host, Value::CreateDoubleValue(level)); | 997 change.host, Value::CreateDoubleValue(level)); |
996 } | 998 } |
997 } | 999 } |
998 | 1000 |
999 #if defined(ENABLE_SESSION_SERVICE) | 1001 #if defined(ENABLE_SESSION_SERVICE) |
1000 void ProfileImpl::StopCreateSessionServiceTimer() { | 1002 void ProfileImpl::StopCreateSessionServiceTimer() { |
1001 create_session_service_timer_.Stop(); | 1003 create_session_service_timer_.Stop(); |
1002 } | 1004 } |
1003 | 1005 |
1004 void ProfileImpl::EnsureSessionServiceCreated() { | 1006 void ProfileImpl::EnsureSessionServiceCreated() { |
1005 SessionServiceFactory::GetForProfile(this); | 1007 SessionServiceFactory::GetForProfile(this); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 base::FilePath* cache_path, | 1188 base::FilePath* cache_path, |
1187 int* max_size) { | 1189 int* max_size) { |
1188 DCHECK(cache_path); | 1190 DCHECK(cache_path); |
1189 DCHECK(max_size); | 1191 DCHECK(max_size); |
1190 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1192 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1191 if (!path.empty()) | 1193 if (!path.empty()) |
1192 *cache_path = path; | 1194 *cache_path = path; |
1193 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1195 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1194 prefs_->GetInteger(prefs::kDiskCacheSize); | 1196 prefs_->GetInteger(prefs::kDiskCacheSize); |
1195 } | 1197 } |
OLD | NEW |