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

Side by Side Diff: chrome/browser/ui/zoom/zoom_controller.h

Issue 508263002: Simplify ZoomController by removing DefaultZoomLevel prefs machinery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 6 years, 3 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 | « no previous file | chrome/browser/ui/zoom/zoom_controller.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 (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
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 // TODO(wjmaclean) Make this refer to the webcontents-specific HostZoomMap
77 // when that becomes available.
78 return content::HostZoomMap::GetDefaultForBrowserContext(browser_context_)->
79 GetDefaultZoomLevel();
80 }
81
73 // Convenience method to quickly check if the tab's at default zoom. 82 // Convenience method to quickly check if the tab's at default zoom.
74 bool IsAtDefaultZoom() const; 83 bool IsAtDefaultZoom() const;
75 84
76 // Returns which image should be loaded for the current zoom level. 85 // Returns which image should be loaded for the current zoom level.
77 int GetResourceForZoomLevel() const; 86 int GetResourceForZoomLevel() const;
78 87
79 const extensions::Extension* last_extension() const { 88 const extensions::Extension* last_extension() const {
80 return last_extension_.get(); 89 return last_extension_.get();
81 } 90 }
82 91
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 144
136 // True if changes to zoom level can trigger the zoom notification bubble. 145 // True if changes to zoom level can trigger the zoom notification bubble.
137 bool can_show_bubble_; 146 bool can_show_bubble_;
138 147
139 // The current zoom mode. 148 // The current zoom mode.
140 ZoomMode zoom_mode_; 149 ZoomMode zoom_mode_;
141 150
142 // Current zoom level. 151 // Current zoom level.
143 double zoom_level_; 152 double zoom_level_;
144 153
145 // Used to access the default zoom level preference.
146 DoublePrefMember default_zoom_level_;
147
148 scoped_ptr<ZoomChangedEventData> event_data_; 154 scoped_ptr<ZoomChangedEventData> event_data_;
149 155
150 // Keeps track of the extension (if any) that initiated the last zoom change 156 // Keeps track of the extension (if any) that initiated the last zoom change
151 // that took effect. 157 // that took effect.
152 scoped_refptr<const extensions::Extension> last_extension_; 158 scoped_refptr<const extensions::Extension> last_extension_;
153 159
154 // Observer receiving notifications on state changes. 160 // Observer receiving notifications on state changes.
155 ObserverList<ZoomObserver> observers_; 161 ObserverList<ZoomObserver> observers_;
156 162
157 content::BrowserContext* browser_context_; 163 content::BrowserContext* browser_context_;
158 164
159 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; 165 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
160 166
161 DISALLOW_COPY_AND_ASSIGN(ZoomController); 167 DISALLOW_COPY_AND_ASSIGN(ZoomController);
162 }; 168 };
163 169
164 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ 170 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/zoom/zoom_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698