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

Side by Side Diff: chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc

Issue 769593003: Move ZoomObserver, ZoomController and ZoomEventManager to components/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete defines in build files. Created 6 years 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 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/json_pref_store.h" 8 #include "base/prefs/json_pref_store.h"
9 #include "base/prefs/pref_filter.h" 9 #include "base/prefs/pref_filter.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/pref_service_factory.h" 11 #include "base/prefs/pref_service_factory.h"
12 #include "base/prefs/scoped_user_pref_update.h" 12 #include "base/prefs/scoped_user_pref_update.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/ui/zoom/zoom_event_manager.h"
16 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "components/ui/zoom/zoom_event_manager.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/host_zoom_map.h" 19 #include "content/public/browser/host_zoom_map.h"
20 #include "content/public/common/page_zoom.h" 20 #include "content/public/common/page_zoom.h"
21 21
22 namespace { 22 namespace {
23 23
24 std::string GetHash( 24 std::string GetHash(
25 const base::FilePath& relative_path) { 25 const base::FilePath& relative_path) {
26 size_t int_key = 26 size_t int_key =
27 BASE_HASH_NAMESPACE::hash<base::FilePath>()(relative_path); 27 BASE_HASH_NAMESPACE::hash<base::FilePath>()(relative_path);
28 return base::SizeTToString(int_key); 28 return base::SizeTToString(int_key);
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 namespace chrome { 33 namespace chrome {
34 34
35 ChromeZoomLevelPrefs::ChromeZoomLevelPrefs( 35 ChromeZoomLevelPrefs::ChromeZoomLevelPrefs(
36 PrefService* pref_service, 36 PrefService* pref_service,
37 const base::FilePath& profile_path, 37 const base::FilePath& profile_path,
38 const base::FilePath& partition_path, 38 const base::FilePath& partition_path,
39 base::WeakPtr<ZoomEventManager> zoom_event_manager) 39 base::WeakPtr<ui_zoom::ZoomEventManager> zoom_event_manager)
40 : pref_service_(pref_service), 40 : pref_service_(pref_service),
41 zoom_event_manager_(zoom_event_manager), 41 zoom_event_manager_(zoom_event_manager),
42 host_zoom_map_(nullptr) { 42 host_zoom_map_(nullptr) {
43 DCHECK(pref_service_); 43 DCHECK(pref_service_);
44 44
45 DCHECK(!partition_path.empty()); 45 DCHECK(!partition_path.empty());
46 DCHECK((partition_path == profile_path) || 46 DCHECK((partition_path == profile_path) ||
47 profile_path.IsParent(partition_path)); 47 profile_path.IsParent(partition_path));
48 // Create a partition_key string with no '.'s in it. For the default 48 // Create a partition_key string with no '.'s in it. For the default
49 // StoragePartition, this string will always be "0". 49 // StoragePartition, this string will always be "0".
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // don't need to worry that host_zoom_dictionary is indirectly affected 198 // don't need to worry that host_zoom_dictionary is indirectly affected
199 // by calls to HostZoomMap::SetZoomLevelForHost(). 199 // by calls to HostZoomMap::SetZoomLevelForHost().
200 ExtractPerHostZoomLevels(host_zoom_dictionary, 200 ExtractPerHostZoomLevels(host_zoom_dictionary,
201 true /* sanitize_partition_host_zoom_levels */); 201 true /* sanitize_partition_host_zoom_levels */);
202 } 202 }
203 zoom_subscription_ = host_zoom_map_->AddZoomLevelChangedCallback(base::Bind( 203 zoom_subscription_ = host_zoom_map_->AddZoomLevelChangedCallback(base::Bind(
204 &ChromeZoomLevelPrefs::OnZoomLevelChanged, base::Unretained(this))); 204 &ChromeZoomLevelPrefs::OnZoomLevelChanged, base::Unretained(this)));
205 } 205 }
206 206
207 } // namespace chrome 207 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/zoom/chrome_zoom_level_prefs.h ('k') | chrome/browser/ui/zoom/zoom_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698