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 COMPONENTS_UI_ZOOM_ZOOM_CONTROLLER_H_ | 5 #ifndef COMPONENTS_UI_ZOOM_ZOOM_CONTROLLER_H_ |
6 #define COMPONENTS_UI_ZOOM_ZOOM_CONTROLLER_H_ | 6 #define COMPONENTS_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/gtest_prod_util.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
13 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
14 #include "content/public/browser/host_zoom_map.h" | 15 #include "content/public/browser/host_zoom_map.h" |
15 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
17 | 18 |
18 class ZoomControllerTest; | 19 class ZoomControllerTest; |
19 | 20 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 // Sets the zoom level via HostZoomMap (or stores it locally if in manual zoom | 130 // Sets the zoom level via HostZoomMap (or stores it locally if in manual zoom |
130 // mode), and attributes the zoom to |client|. Returns true on success. | 131 // mode), and attributes the zoom to |client|. Returns true on success. |
131 bool SetZoomLevelByClient( | 132 bool SetZoomLevelByClient( |
132 double zoom_level, | 133 double zoom_level, |
133 const scoped_refptr<const ZoomRequestClient>& client); | 134 const scoped_refptr<const ZoomRequestClient>& client); |
134 | 135 |
135 // Sets the zoom mode, which defines zoom behavior (see enum ZoomMode). | 136 // Sets the zoom mode, which defines zoom behavior (see enum ZoomMode). |
136 void SetZoomMode(ZoomMode zoom_mode); | 137 void SetZoomMode(ZoomMode zoom_mode); |
137 | 138 |
| 139 // Set and query whether or not the page scale factor is one. |
| 140 void SetPageScaleFactorIsOneForTesting(bool is_one); |
| 141 bool PageScaleFactorIsOne() const; |
| 142 |
138 // content::WebContentsObserver overrides: | 143 // content::WebContentsObserver overrides: |
139 void DidNavigateMainFrame( | 144 void DidNavigateMainFrame( |
140 const content::LoadCommittedDetails& details, | 145 const content::LoadCommittedDetails& details, |
141 const content::FrameNavigateParams& params) override; | 146 const content::FrameNavigateParams& params) override; |
142 void WebContentsDestroyed() override; | 147 void WebContentsDestroyed() override; |
143 void RenderFrameHostChanged(content::RenderFrameHost* old_host, | 148 void RenderFrameHostChanged(content::RenderFrameHost* old_host, |
144 content::RenderFrameHost* new_host) override; | 149 content::RenderFrameHost* new_host) override; |
145 | 150 |
146 protected: | 151 protected: |
147 // Protected for testing. | 152 // Protected for testing. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 content::HostZoomMap* host_zoom_map_; | 188 content::HostZoomMap* host_zoom_map_; |
184 | 189 |
185 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | 190 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
186 | 191 |
187 DISALLOW_COPY_AND_ASSIGN(ZoomController); | 192 DISALLOW_COPY_AND_ASSIGN(ZoomController); |
188 }; | 193 }; |
189 | 194 |
190 } // namespace ui_zoom | 195 } // namespace ui_zoom |
191 | 196 |
192 #endif // COMPONENTS_UI_ZOOM_ZOOM_CONTROLLER_H_ | 197 #endif // COMPONENTS_UI_ZOOM_ZOOM_CONTROLLER_H_ |
OLD | NEW |