| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/zoom/chrome_zoom_level_prefs.h" | 5 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/prefs/json_pref_store.h" | 10 #include "base/prefs/json_pref_store.h" |
| 11 #include "base/prefs/pref_filter.h" | 11 #include "base/prefs/pref_filter.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service_factory.h" | 13 #include "base/prefs/pref_service_factory.h" |
| 14 #include "base/prefs/scoped_user_pref_update.h" | 14 #include "base/prefs/scoped_user_pref_update.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/host_zoom_map.h" | 20 #include "content/public/browser/host_zoom_map.h" |
| 21 #include "content/public/common/page_zoom.h" | 21 #include "content/public/common/page_zoom.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 std::string GetHash( | 25 std::string GetHash( |
| 26 const base::FilePath& relative_path) { | 26 const base::FilePath& relative_path) { |
| 27 size_t int_key = | 27 size_t int_key = |
| 28 #if defined(COMPILER_MSVC) | |
| 29 BASE_HASH_NAMESPACE::hash_value(relative_path); | |
| 30 #else | |
| 31 BASE_HASH_NAMESPACE::hash<base::FilePath>()(relative_path); | 28 BASE_HASH_NAMESPACE::hash<base::FilePath>()(relative_path); |
| 32 #endif // COMPILER | |
| 33 return base::SizeTToString(int_key); | 29 return base::SizeTToString(int_key); |
| 34 } | 30 } |
| 35 | 31 |
| 36 } // namespace | 32 } // namespace |
| 37 | 33 |
| 38 namespace chrome { | 34 namespace chrome { |
| 39 | 35 |
| 40 ChromeZoomLevelPrefs::ChromeZoomLevelPrefs(PrefService* pref_service, | 36 ChromeZoomLevelPrefs::ChromeZoomLevelPrefs(PrefService* pref_service, |
| 41 const base::FilePath& profile_path) | 37 const base::FilePath& profile_path) |
| 42 : pref_service_(pref_service), | 38 : pref_service_(pref_service), |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 base::DictionaryValue* host_zoom_dictionaries = update.Get(); | 190 base::DictionaryValue* host_zoom_dictionaries = update.Get(); |
| 195 base::DictionaryValue* host_zoom_dictionary = nullptr; | 191 base::DictionaryValue* host_zoom_dictionary = nullptr; |
| 196 host_zoom_dictionaries->GetDictionary(partition_key_, | 192 host_zoom_dictionaries->GetDictionary(partition_key_, |
| 197 &host_zoom_dictionary); | 193 &host_zoom_dictionary); |
| 198 for (const std::string& s : keys_to_remove) | 194 for (const std::string& s : keys_to_remove) |
| 199 host_zoom_dictionary->RemoveWithoutPathExpansion(s, nullptr); | 195 host_zoom_dictionary->RemoveWithoutPathExpansion(s, nullptr); |
| 200 } | 196 } |
| 201 } | 197 } |
| 202 | 198 |
| 203 } // namespace chrome | 199 } // namespace chrome |
| OLD | NEW |