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

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

Issue 377423002: Make ChromeAutofillClient a ZoomObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo in comment. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller.h ('k') | no next file » | 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 #include "chrome/browser/ui/zoom/zoom_controller.h" 5 #include "chrome/browser/ui/zoom/zoom_controller.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 251
252 void ZoomController::DidNavigateMainFrame( 252 void ZoomController::DidNavigateMainFrame(
253 const content::LoadCommittedDetails& details, 253 const content::LoadCommittedDetails& details,
254 const content::FrameNavigateParams& params) { 254 const content::FrameNavigateParams& params) {
255 // If the main frame's content has changed, the new page may have a different 255 // If the main frame's content has changed, the new page may have a different
256 // zoom level from the old one. 256 // zoom level from the old one.
257 UpdateState(std::string()); 257 UpdateState(std::string());
258 } 258 }
259 259
260 void ZoomController::WebContentsDestroyed() {
261 // At this point we should no longer be sending any zoom events with this
262 // WebContents.
263 observers_.Clear();
264 }
265
260 void ZoomController::OnZoomLevelChanged( 266 void ZoomController::OnZoomLevelChanged(
261 const content::HostZoomMap::ZoomLevelChange& change) { 267 const content::HostZoomMap::ZoomLevelChange& change) {
262 UpdateState(change.host); 268 UpdateState(change.host);
263 } 269 }
264 270
265 void ZoomController::UpdateState(const std::string& host) { 271 void ZoomController::UpdateState(const std::string& host) {
266 // If |host| is empty, all observers should be updated. 272 // If |host| is empty, all observers should be updated.
267 if (!host.empty()) { 273 if (!host.empty()) {
268 // Use the navigation entry's URL instead of the WebContents' so virtual 274 // Use the navigation entry's URL instead of the WebContents' so virtual
269 // URLs work (e.g. chrome://settings). http://crbug.com/153950 275 // URLs work (e.g. chrome://settings). http://crbug.com/153950
(...skipping 20 matching lines...) Expand all
290 } else { 296 } else {
291 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and 297 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and
292 // new zoom levels here? 298 // new zoom levels here?
293 double zoom_level = GetZoomLevel(); 299 double zoom_level = GetZoomLevel();
294 ZoomChangedEventData zoom_change_data( 300 ZoomChangedEventData zoom_change_data(
295 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble); 301 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble);
296 FOR_EACH_OBSERVER( 302 FOR_EACH_OBSERVER(
297 ZoomObserver, observers_, OnZoomChanged(zoom_change_data)); 303 ZoomObserver, observers_, OnZoomChanged(zoom_change_data));
298 } 304 }
299 } 305 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698