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

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

Issue 66993003: Most references to GetActiveEntry removed from chrome/browser/ui. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT Created 7 years, 1 month 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void ZoomController::OnZoomLevelChanged( 66 void ZoomController::OnZoomLevelChanged(
67 const content::HostZoomMap::ZoomLevelChange& change) { 67 const content::HostZoomMap::ZoomLevelChange& change) {
68 UpdateState(change.host); 68 UpdateState(change.host);
69 } 69 }
70 70
71 void ZoomController::UpdateState(const std::string& host) { 71 void ZoomController::UpdateState(const std::string& host) {
72 // If |host| is empty, all observers should be updated. 72 // If |host| is empty, all observers should be updated.
73 if (!host.empty()) { 73 if (!host.empty()) {
74 // Use the active navigation entry's URL instead of the WebContents' so 74 // Use the navigation entry's URL instead of the WebContents' so virtual
75 // virtual URLs work (e.g. chrome://settings). http://crbug.com/153950 75 // URLs work (e.g. chrome://settings). http://crbug.com/153950
76 content::NavigationEntry* active_entry = 76 content::NavigationEntry* entry =
77 web_contents()->GetController().GetActiveEntry(); 77 web_contents()->GetController().GetLastCommittedEntry();
78 if (!active_entry || 78 if (!entry ||
79 host != net::GetHostOrSpecFromURL(active_entry->GetURL())) { 79 host != net::GetHostOrSpecFromURL(entry->GetURL())) {
80 return; 80 return;
81 } 81 }
82 } 82 }
83 83
84 bool dummy; 84 bool dummy;
85 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); 85 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy);
86 86
87 if (observer_) 87 if (observer_)
88 observer_->OnZoomChanged(web_contents(), !host.empty()); 88 observer_->OnZoomChanged(web_contents(), !host.empty());
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698