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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 friend class content::WebContentsUserData<ZoomController>; | 113 friend class content::WebContentsUserData<ZoomController>; |
114 friend class ZoomControllerTest; | 114 friend class ZoomControllerTest; |
115 | 115 |
116 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | 116 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
117 | 117 |
118 // Updates the zoom icon and zoom percentage based on current values and | 118 // Updates the zoom icon and zoom percentage based on current values and |
119 // notifies the observer if changes have occurred. |host| may be empty, | 119 // notifies the observer if changes have occurred. |host| may be empty, |
120 // meaning the change should apply to ~all sites. If it is not empty, the | 120 // meaning the change should apply to ~all sites. If it is not empty, the |
121 // change only affects sites with the given host. | 121 // change only affects sites with the given host. |
122 void UpdateState(const std::string& host); | 122 void UpdateState(const std::string& host); |
123 // Same as UpdateState, but takes into account whether a temporary zoom level | |
124 // has been set on |host| when deciding whether to show the zoom notification | |
125 // bubble. | |
126 void UpdateStateIncludingTemporary(const std::string& host, | |
127 bool is_temporary_zoom); | |
128 | 123 |
129 // The current zoom mode. | 124 // The current zoom mode. |
130 ZoomMode zoom_mode_; | 125 ZoomMode zoom_mode_; |
131 | 126 |
132 // Current zoom level. | 127 // Current zoom level. |
133 double zoom_level_; | 128 double zoom_level_; |
134 | 129 |
135 // Used to access the default zoom level preference. | 130 // Used to access the default zoom level preference. |
136 DoublePrefMember default_zoom_level_; | 131 DoublePrefMember default_zoom_level_; |
137 | 132 |
138 scoped_ptr<ZoomChangedEventData> event_data_; | 133 scoped_ptr<ZoomChangedEventData> event_data_; |
139 | 134 |
140 // Keeps track of the extension (if any) that initiated the last zoom change | 135 // Keeps track of the extension (if any) that initiated the last zoom change |
141 // that took effect. | 136 // that took effect. |
142 scoped_refptr<const extensions::Extension> last_extension_; | 137 scoped_refptr<const extensions::Extension> last_extension_; |
143 | 138 |
144 // Observer receiving notifications on state changes. | 139 // Observer receiving notifications on state changes. |
145 ObserverList<ZoomObserver> observers_; | 140 ObserverList<ZoomObserver> observers_; |
146 | 141 |
147 content::BrowserContext* browser_context_; | 142 content::BrowserContext* browser_context_; |
148 | 143 |
149 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | 144 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
150 | 145 |
151 DISALLOW_COPY_AND_ASSIGN(ZoomController); | 146 DISALLOW_COPY_AND_ASSIGN(ZoomController); |
152 }; | 147 }; |
153 | 148 |
154 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 149 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
OLD | NEW |