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

Unified Diff: chrome/browser/ui/browser.cc

Issue 10444040: Tracks changes to zoom icon and zoom percentage. Notifies browser window if the icon should be chan… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 3d5c55cd6669dbb5d18c760c9d6166ff0d624315..8ecbaad90b752fa385735331753e2791d5872ea5 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -3712,6 +3712,27 @@ void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) {
}
///////////////////////////////////////////////////////////////////////////////
+// Browser, ZoomObserver implementation:
+
+void Browser::OnZoomIconChanged(TabContentsWrapper* source,
+ ZoomController::ZoomIconState state) {
+ if (source == GetSelectedTabContentsWrapper())
+ window_->SetZoomIconState(state);
+}
+
+void Browser::OnZoomChanged(TabContentsWrapper* source,
+ int zoom_percent,
+ bool can_show_bubble) {
+ if (source == GetSelectedTabContentsWrapper()) {
+ window_->SetZoomIconTooltipPercent(zoom_percent);
+
+ // Only show the zoom bubble for zoom changes in the active window.
+ if (can_show_bubble && window_->IsActive())
+ window_->ShowZoomBubble(zoom_percent);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
// Browser, ExtensionTabHelperDelegate implementation:
void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source,
@@ -4195,6 +4216,10 @@ void Browser::UpdateCommandsForTabState() {
// Page-related commands
window_->SetStarredState(
current_tab_wrapper->bookmark_tab_helper()->is_starred());
+ window_->SetZoomIconState(
+ current_tab_wrapper->zoom_controller()->zoom_icon_state());
+ window_->SetZoomIconTooltipPercent(
+ current_tab_wrapper->zoom_controller()->zoom_percent());
command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
current_tab->GetController().CanViewSource());
command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
@@ -4691,6 +4716,7 @@ void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) {
// ...and all the helpers.
tab->blocked_content_tab_helper()->set_delegate(delegate);
tab->bookmark_tab_helper()->set_delegate(delegate);
+ tab->zoom_controller()->set_observer(delegate);
tab->constrained_window_tab_helper()->set_delegate(delegate);
tab->core_tab_helper()->set_delegate(delegate);
tab->extension_tab_helper()->set_delegate(delegate);
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698