| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~ZoomController(); |
| 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 |
| 74 // inlining. |
| 75 double GetDefaultZoomLevel() const { |
| 76 return content::HostZoomMap::GetForWebContents(web_contents()) |
| 77 ->GetDefaultZoomLevel(); |
| 78 } |
| 79 |
| 73 // Convenience method to quickly check if the tab's at default zoom. | 80 // Convenience method to quickly check if the tab's at default zoom. |
| 74 bool IsAtDefaultZoom() const; | 81 bool IsAtDefaultZoom() const; |
| 75 | 82 |
| 76 // Returns which image should be loaded for the current zoom level. | 83 // Returns which image should be loaded for the current zoom level. |
| 77 int GetResourceForZoomLevel() const; | 84 int GetResourceForZoomLevel() const; |
| 78 | 85 |
| 79 const extensions::Extension* last_extension() const { | 86 const extensions::Extension* last_extension() const { |
| 80 return last_extension_.get(); | 87 return last_extension_.get(); |
| 81 } | 88 } |
| 82 | 89 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 142 |
| 136 // True if changes to zoom level can trigger the zoom notification bubble. | 143 // True if changes to zoom level can trigger the zoom notification bubble. |
| 137 bool can_show_bubble_; | 144 bool can_show_bubble_; |
| 138 | 145 |
| 139 // The current zoom mode. | 146 // The current zoom mode. |
| 140 ZoomMode zoom_mode_; | 147 ZoomMode zoom_mode_; |
| 141 | 148 |
| 142 // Current zoom level. | 149 // Current zoom level. |
| 143 double zoom_level_; | 150 double zoom_level_; |
| 144 | 151 |
| 145 // Used to access the default zoom level preference. | |
| 146 DoublePrefMember default_zoom_level_; | |
| 147 | |
| 148 scoped_ptr<ZoomChangedEventData> event_data_; | 152 scoped_ptr<ZoomChangedEventData> event_data_; |
| 149 | 153 |
| 150 // Keeps track of the extension (if any) that initiated the last zoom change | 154 // Keeps track of the extension (if any) that initiated the last zoom change |
| 151 // that took effect. | 155 // that took effect. |
| 152 scoped_refptr<const extensions::Extension> last_extension_; | 156 scoped_refptr<const extensions::Extension> last_extension_; |
| 153 | 157 |
| 154 // Observer receiving notifications on state changes. | 158 // Observer receiving notifications on state changes. |
| 155 ObserverList<ZoomObserver> observers_; | 159 ObserverList<ZoomObserver> observers_; |
| 156 | 160 |
| 157 content::BrowserContext* browser_context_; | 161 content::BrowserContext* browser_context_; |
| 158 | 162 |
| 159 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | 163 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
| 160 | 164 |
| 161 DISALLOW_COPY_AND_ASSIGN(ZoomController); | 165 DISALLOW_COPY_AND_ASSIGN(ZoomController); |
| 162 }; | 166 }; |
| 163 | 167 |
| 164 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 168 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
| OLD | NEW |