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

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: Make ChromeAutofillClient responsible for adding itself as a ZoomObserver. 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
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 void ZoomController::DidNavigateMainFrame( 251 void ZoomController::DidNavigateMainFrame(
252 const content::LoadCommittedDetails& details, 252 const content::LoadCommittedDetails& details,
253 const content::FrameNavigateParams& params) { 253 const content::FrameNavigateParams& params) {
254 // If the main frame's content has changed, the new page may have a different 254 // If the main frame's content has changed, the new page may have a different
255 // zoom level from the old one. 255 // zoom level from the old one.
256 UpdateState(std::string()); 256 UpdateState(std::string());
257 } 257 }
258 258
259 void ZoomController::WebContentsDestroyed() {
260 // At this point we should no longer be sending any zoom events with this
261 // WebContents.
262 observers_.Clear();
263 }
264
259 void ZoomController::OnZoomLevelChanged( 265 void ZoomController::OnZoomLevelChanged(
260 const content::HostZoomMap::ZoomLevelChange& change) { 266 const content::HostZoomMap::ZoomLevelChange& change) {
261 UpdateState(change.host); 267 UpdateState(change.host);
262 } 268 }
263 269
264 void ZoomController::UpdateState(const std::string& host) { 270 void ZoomController::UpdateState(const std::string& host) {
265 // If |host| is empty, all observers should be updated. 271 // If |host| is empty, all observers should be updated.
266 if (!host.empty()) { 272 if (!host.empty()) {
267 // Use the navigation entry's URL instead of the WebContents' so virtual 273 // Use the navigation entry's URL instead of the WebContents' so virtual
268 // URLs work (e.g. chrome://settings). http://crbug.com/153950 274 // URLs work (e.g. chrome://settings). http://crbug.com/153950
(...skipping 20 matching lines...) Expand all
289 } else { 295 } else {
290 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and 296 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and
291 // new zoom levels here? 297 // new zoom levels here?
292 double zoom_level = GetZoomLevel(); 298 double zoom_level = GetZoomLevel();
293 ZoomChangedEventData zoom_change_data( 299 ZoomChangedEventData zoom_change_data(
294 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble); 300 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble);
295 FOR_EACH_OBSERVER( 301 FOR_EACH_OBSERVER(
296 ZoomObserver, observers_, OnZoomChanged(zoom_change_data)); 302 ZoomObserver, observers_, OnZoomChanged(zoom_change_data));
297 } 303 }
298 } 304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698