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

Side by Side Diff: components/ui/zoom/zoom_event_manager.h

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « components/ui/zoom/zoom_controller.h ('k') | components/ui/zoom/zoom_event_manager.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 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 #ifndef COMPONENTS_UI_ZOOM_ZOOM_EVENT_MANAGER_H_ 5 #ifndef COMPONENTS_UI_ZOOM_ZOOM_EVENT_MANAGER_H_
6 #define COMPONENTS_UI_ZOOM_ZOOM_EVENT_MANAGER_H_ 6 #define COMPONENTS_UI_ZOOM_ZOOM_EVENT_MANAGER_H_
7 7
8 #include <memory>
9
8 #include "base/callback_list.h" 10 #include "base/callback_list.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/observer_list.h" 13 #include "base/observer_list.h"
13 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
14 #include "content/public/browser/host_zoom_map.h" 15 #include "content/public/browser/host_zoom_map.h"
15 16
16 namespace content { 17 namespace content {
17 class BrowserContext; 18 class BrowserContext;
18 } // namespace content 19 } // namespace content
19 20
20 namespace ui_zoom { 21 namespace ui_zoom {
(...skipping 13 matching lines...) Expand all
34 static ZoomEventManager* GetForBrowserContext( 35 static ZoomEventManager* GetForBrowserContext(
35 content::BrowserContext* context); 36 content::BrowserContext* context);
36 37
37 // Called by ZoomControllers when changes are made to zoom levels in manual 38 // Called by ZoomControllers when changes are made to zoom levels in manual
38 // mode in order that browser listeners can be notified. 39 // mode in order that browser listeners can be notified.
39 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); 40 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
40 41
41 // Add and remove zoom level changed callbacks. 42 // Add and remove zoom level changed callbacks.
42 // TODO(wjmaclean): Convert this callback mechanism to use 43 // TODO(wjmaclean): Convert this callback mechanism to use
43 // ZoomEventManagerObserver instead. 44 // ZoomEventManagerObserver instead.
44 scoped_ptr<content::HostZoomMap::Subscription> AddZoomLevelChangedCallback( 45 std::unique_ptr<content::HostZoomMap::Subscription>
46 AddZoomLevelChangedCallback(
45 const content::HostZoomMap::ZoomLevelChangedCallback& callback); 47 const content::HostZoomMap::ZoomLevelChangedCallback& callback);
46 48
47 // Called by ZoomLevelDelegates when changes are made to the default zoom 49 // Called by ZoomLevelDelegates when changes are made to the default zoom
48 // level for their associated HostZoomMap. 50 // level for their associated HostZoomMap.
49 void OnDefaultZoomLevelChanged(); 51 void OnDefaultZoomLevelChanged();
50 52
51 // Add and remove observers. 53 // Add and remove observers.
52 void AddZoomEventManagerObserver(ZoomEventManagerObserver* observer); 54 void AddZoomEventManagerObserver(ZoomEventManagerObserver* observer);
53 void RemoveZoomEventManagerObserver(ZoomEventManagerObserver* observer); 55 void RemoveZoomEventManagerObserver(ZoomEventManagerObserver* observer);
54 56
55 // Get a weak ptr to be used by clients who may themselves be UserData for 57 // Get a weak ptr to be used by clients who may themselves be UserData for
56 // the context, since the order of destruction is undefined between the client 58 // the context, since the order of destruction is undefined between the client
57 // and this class. 59 // and this class.
58 base::WeakPtr<ZoomEventManager> GetWeakPtr() { 60 base::WeakPtr<ZoomEventManager> GetWeakPtr() {
59 return weak_ptr_factory_.GetWeakPtr(); 61 return weak_ptr_factory_.GetWeakPtr();
60 } 62 }
61 63
62 private: 64 private:
63 base::CallbackList<void(const content::HostZoomMap::ZoomLevelChange&)> 65 base::CallbackList<void(const content::HostZoomMap::ZoomLevelChange&)>
64 zoom_level_changed_callbacks_; 66 zoom_level_changed_callbacks_;
65 base::ObserverList<ZoomEventManagerObserver> observers_; 67 base::ObserverList<ZoomEventManagerObserver> observers_;
66 base::WeakPtrFactory<ZoomEventManager> weak_ptr_factory_; 68 base::WeakPtrFactory<ZoomEventManager> weak_ptr_factory_;
67 69
68 DISALLOW_COPY_AND_ASSIGN(ZoomEventManager); 70 DISALLOW_COPY_AND_ASSIGN(ZoomEventManager);
69 }; 71 };
70 72
71 } // namespace ui_zoom 73 } // namespace ui_zoom
72 74
73 #endif // COMPONENTS_UI_ZOOM_ZOOM_EVENT_MANAGER_H_ 75 #endif // COMPONENTS_UI_ZOOM_ZOOM_EVENT_MANAGER_H_
OLDNEW
« no previous file with comments | « components/ui/zoom/zoom_controller.h ('k') | components/ui/zoom/zoom_event_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698