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

Side by Side 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 unified diff | 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 »
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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 3694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3705 3705
3706 /////////////////////////////////////////////////////////////////////////////// 3706 ///////////////////////////////////////////////////////////////////////////////
3707 // Browser, BookmarkTabHelperDelegate implementation: 3707 // Browser, BookmarkTabHelperDelegate implementation:
3708 3708
3709 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) { 3709 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) {
3710 if (source == GetSelectedTabContentsWrapper()) 3710 if (source == GetSelectedTabContentsWrapper())
3711 window_->SetStarredState(starred); 3711 window_->SetStarredState(starred);
3712 } 3712 }
3713 3713
3714 /////////////////////////////////////////////////////////////////////////////// 3714 ///////////////////////////////////////////////////////////////////////////////
3715 // Browser, ZoomObserver implementation:
3716
3717 void Browser::OnZoomIconChanged(TabContentsWrapper* source,
3718 ZoomController::ZoomIconState state) {
3719 if (source == GetSelectedTabContentsWrapper())
3720 window_->SetZoomIconState(state);
3721 }
3722
3723 void Browser::OnZoomChanged(TabContentsWrapper* source,
3724 int zoom_percent,
3725 bool can_show_bubble) {
3726 if (source == GetSelectedTabContentsWrapper()) {
3727 window_->SetZoomIconTooltipPercent(zoom_percent);
3728
3729 // Only show the zoom bubble for zoom changes in the active window.
3730 if (can_show_bubble && window_->IsActive())
3731 window_->ShowZoomBubble(zoom_percent);
3732 }
3733 }
3734
3735 ///////////////////////////////////////////////////////////////////////////////
3715 // Browser, ExtensionTabHelperDelegate implementation: 3736 // Browser, ExtensionTabHelperDelegate implementation:
3716 3737
3717 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, 3738 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source,
3718 int32 page_id) { 3739 int32 page_id) {
3719 if (GetSelectedTabContentsWrapper() != source) 3740 if (GetSelectedTabContentsWrapper() != source)
3720 return; 3741 return;
3721 3742
3722 NavigationEntry* entry = 3743 NavigationEntry* entry =
3723 source->web_contents()->GetController().GetLastCommittedEntry(); 3744 source->web_contents()->GetController().GetLastCommittedEntry();
3724 if (!entry || (entry->GetPageID() != page_id)) 3745 if (!entry || (entry->GetPageID() != page_id))
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
4188 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, 4209 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
4189 CanReloadContents(current_tab)); 4210 CanReloadContents(current_tab));
4190 4211
4191 // Window management commands 4212 // Window management commands
4192 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 4213 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
4193 !is_app() && CanDuplicateContentsAt(active_index())); 4214 !is_app() && CanDuplicateContentsAt(active_index()));
4194 4215
4195 // Page-related commands 4216 // Page-related commands
4196 window_->SetStarredState( 4217 window_->SetStarredState(
4197 current_tab_wrapper->bookmark_tab_helper()->is_starred()); 4218 current_tab_wrapper->bookmark_tab_helper()->is_starred());
4219 window_->SetZoomIconState(
4220 current_tab_wrapper->zoom_controller()->zoom_icon_state());
4221 window_->SetZoomIconTooltipPercent(
4222 current_tab_wrapper->zoom_controller()->zoom_percent());
4198 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 4223 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
4199 current_tab->GetController().CanViewSource()); 4224 current_tab->GetController().CanViewSource());
4200 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, 4225 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
4201 toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid()); 4226 toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid());
4202 if (is_devtools()) 4227 if (is_devtools())
4203 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false); 4228 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
4204 4229
4205 // Changing the encoding is not possible on Chrome-internal webpages. 4230 // Changing the encoding is not possible on Chrome-internal webpages.
4206 bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) || 4231 bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) ||
4207 current_tab->ShowingInterstitialPage(); 4232 current_tab->ShowingInterstitialPage();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4684 /////////////////////////////////////////////////////////////////////////////// 4709 ///////////////////////////////////////////////////////////////////////////////
4685 // Browser, Assorted utility functions (private): 4710 // Browser, Assorted utility functions (private):
4686 4711
4687 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { 4712 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) {
4688 // WebContents... 4713 // WebContents...
4689 tab->web_contents()->SetDelegate(delegate); 4714 tab->web_contents()->SetDelegate(delegate);
4690 4715
4691 // ...and all the helpers. 4716 // ...and all the helpers.
4692 tab->blocked_content_tab_helper()->set_delegate(delegate); 4717 tab->blocked_content_tab_helper()->set_delegate(delegate);
4693 tab->bookmark_tab_helper()->set_delegate(delegate); 4718 tab->bookmark_tab_helper()->set_delegate(delegate);
4719 tab->zoom_controller()->set_observer(delegate);
4694 tab->constrained_window_tab_helper()->set_delegate(delegate); 4720 tab->constrained_window_tab_helper()->set_delegate(delegate);
4695 tab->core_tab_helper()->set_delegate(delegate); 4721 tab->core_tab_helper()->set_delegate(delegate);
4696 tab->extension_tab_helper()->set_delegate(delegate); 4722 tab->extension_tab_helper()->set_delegate(delegate);
4697 tab->search_engine_tab_helper()->set_delegate(delegate); 4723 tab->search_engine_tab_helper()->set_delegate(delegate);
4698 } 4724 }
4699 4725
4700 void Browser::FindInPage(bool find_next, bool forward_direction) { 4726 void Browser::FindInPage(bool find_next, bool forward_direction) {
4701 ShowFindBar(); 4727 ShowFindBar();
4702 if (find_next) { 4728 if (find_next) {
4703 string16 find_text; 4729 string16 find_text;
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
5121 if (contents && !allow_js_access) { 5147 if (contents && !allow_js_access) {
5122 contents->web_contents()->GetController().LoadURL( 5148 contents->web_contents()->GetController().LoadURL(
5123 target_url, 5149 target_url,
5124 content::Referrer(), 5150 content::Referrer(),
5125 content::PAGE_TRANSITION_LINK, 5151 content::PAGE_TRANSITION_LINK,
5126 std::string()); // No extra headers. 5152 std::string()); // No extra headers.
5127 } 5153 }
5128 5154
5129 return contents != NULL; 5155 return contents != NULL;
5130 } 5156 }
OLDNEW
« 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