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 #ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 new_zoom_level(new_zoom_level), | 59 new_zoom_level(new_zoom_level), |
60 zoom_mode(zoom_mode), | 60 zoom_mode(zoom_mode), |
61 can_show_bubble(can_show_bubble) {} | 61 can_show_bubble(can_show_bubble) {} |
62 content::WebContents* web_contents; | 62 content::WebContents* web_contents; |
63 double old_zoom_level; | 63 double old_zoom_level; |
64 double new_zoom_level; | 64 double new_zoom_level; |
65 ZoomController::ZoomMode zoom_mode; | 65 ZoomController::ZoomMode zoom_mode; |
66 bool can_show_bubble; | 66 bool can_show_bubble; |
67 }; | 67 }; |
68 | 68 |
69 virtual ~ZoomController(); | 69 ~ZoomController() override; |
70 | 70 |
71 ZoomMode zoom_mode() const { return zoom_mode_; } | 71 ZoomMode zoom_mode() const { return zoom_mode_; } |
72 | 72 |
73 // Convenience method to get default zoom level. Implemented here for | 73 // Convenience method to get default zoom level. Implemented here for |
74 // inlining. | 74 // inlining. |
75 double GetDefaultZoomLevel() const { | 75 double GetDefaultZoomLevel() const { |
76 // TODO(wjmaclean) Make this refer to the webcontents-specific HostZoomMap | 76 // TODO(wjmaclean) Make this refer to the webcontents-specific HostZoomMap |
77 // when that becomes available. | 77 // when that becomes available. |
78 return content::HostZoomMap::GetDefaultForBrowserContext(browser_context_)-> | 78 return content::HostZoomMap::GetDefaultForBrowserContext(browser_context_)-> |
79 GetDefaultZoomLevel(); | 79 GetDefaultZoomLevel(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Sets the zoom level via HostZoomMap (or stores it locally if in manual zoom | 114 // Sets the zoom level via HostZoomMap (or stores it locally if in manual zoom |
115 // mode), and attributes the zoom to |extension|. Returns true on success. | 115 // mode), and attributes the zoom to |extension|. Returns true on success. |
116 bool SetZoomLevelByExtension( | 116 bool SetZoomLevelByExtension( |
117 double zoom_level, | 117 double zoom_level, |
118 const scoped_refptr<const extensions::Extension>& extension); | 118 const scoped_refptr<const extensions::Extension>& extension); |
119 | 119 |
120 // Sets the zoom mode, which defines zoom behavior (see enum ZoomMode). | 120 // Sets the zoom mode, which defines zoom behavior (see enum ZoomMode). |
121 void SetZoomMode(ZoomMode zoom_mode); | 121 void SetZoomMode(ZoomMode zoom_mode); |
122 | 122 |
123 // content::WebContentsObserver overrides: | 123 // content::WebContentsObserver overrides: |
124 virtual void DidNavigateMainFrame( | 124 void DidNavigateMainFrame( |
125 const content::LoadCommittedDetails& details, | 125 const content::LoadCommittedDetails& details, |
126 const content::FrameNavigateParams& params) override; | 126 const content::FrameNavigateParams& params) override; |
127 virtual void WebContentsDestroyed() override; | 127 void WebContentsDestroyed() override; |
128 | 128 |
129 protected: | 129 protected: |
130 // Protected for testing. | 130 // Protected for testing. |
131 explicit ZoomController(content::WebContents* web_contents); | 131 explicit ZoomController(content::WebContents* web_contents); |
132 | 132 |
133 private: | 133 private: |
134 friend class content::WebContentsUserData<ZoomController>; | 134 friend class content::WebContentsUserData<ZoomController>; |
135 friend class ZoomControllerTest; | 135 friend class ZoomControllerTest; |
136 | 136 |
137 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | 137 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
(...skipping 23 matching lines...) Expand all Loading... |
161 ObserverList<ZoomObserver> observers_; | 161 ObserverList<ZoomObserver> observers_; |
162 | 162 |
163 content::BrowserContext* browser_context_; | 163 content::BrowserContext* browser_context_; |
164 | 164 |
165 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | 165 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
166 | 166 |
167 DISALLOW_COPY_AND_ASSIGN(ZoomController); | 167 DISALLOW_COPY_AND_ASSIGN(ZoomController); |
168 }; | 168 }; |
169 | 169 |
170 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 170 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
OLD | NEW |