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

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

Issue 11866004: Add scheme to HostZoomMap (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix alignment, add comment Created 7 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 unified diff | Download patch
OLDNEW
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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // Careful: The returned value could be NULL if the pref has never been set. 569 // Careful: The returned value could be NULL if the pref has never been set.
570 if (host_zoom_dictionary != NULL) { 570 if (host_zoom_dictionary != NULL) {
571 for (DictionaryValue::key_iterator i(host_zoom_dictionary->begin_keys()); 571 for (DictionaryValue::key_iterator i(host_zoom_dictionary->begin_keys());
572 i != host_zoom_dictionary->end_keys(); ++i) { 572 i != host_zoom_dictionary->end_keys(); ++i) {
573 const std::string& host(*i); 573 const std::string& host(*i);
574 double zoom_level = 0; 574 double zoom_level = 0;
575 575
576 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( 576 bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion(
577 host, &zoom_level); 577 host, &zoom_level);
578 DCHECK(success); 578 DCHECK(success);
579 host_zoom_map->SetZoomLevel(host, zoom_level); 579 host_zoom_map->SetZoomLevelForHost(host, zoom_level);
580 } 580 }
581 } 581 }
582 582
583 host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); 583 host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_);
584 } 584 }
585 585
586 base::FilePath ProfileImpl::last_selected_directory() { 586 base::FilePath ProfileImpl::last_selected_directory() {
587 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); 587 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
588 } 588 }
589 589
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 973
974 void ProfileImpl::OnDefaultZoomLevelChanged() { 974 void ProfileImpl::OnDefaultZoomLevelChanged() {
975 HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel( 975 HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel(
976 pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel)); 976 pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel));
977 } 977 }
978 978
979 void ProfileImpl::OnZoomLevelChanged(const std::string& host) { 979 void ProfileImpl::OnZoomLevelChanged(const std::string& host) {
980 if (host.empty()) 980 if (host.empty())
981 return; 981 return;
982 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); 982 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
983 double level = host_zoom_map->GetZoomLevel(host); 983 double level = host_zoom_map->GetZoomLevelForHost(host);
984 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); 984 DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
985 DictionaryValue* host_zoom_dictionary = update.Get(); 985 DictionaryValue* host_zoom_dictionary = update.Get();
986 if (level == host_zoom_map->GetDefaultZoomLevel()) { 986 if (level == host_zoom_map->GetDefaultZoomLevel()) {
987 host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL); 987 host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL);
988 } else { 988 } else {
989 host_zoom_dictionary->SetWithoutPathExpansion( 989 host_zoom_dictionary->SetWithoutPathExpansion(
990 host, Value::CreateDoubleValue(level)); 990 host, Value::CreateDoubleValue(level));
991 } 991 }
992 } 992 }
993 993
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 base::FilePath* cache_path, 1181 base::FilePath* cache_path,
1182 int* max_size) { 1182 int* max_size) {
1183 DCHECK(cache_path); 1183 DCHECK(cache_path);
1184 DCHECK(max_size); 1184 DCHECK(max_size);
1185 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1185 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1186 if (!path.empty()) 1186 if (!path.empty())
1187 *cache_path = path; 1187 *cache_path = path;
1188 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1188 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1189 prefs_->GetInteger(prefs::kDiskCacheSize); 1189 prefs_->GetInteger(prefs::kDiskCacheSize);
1190 } 1190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698