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

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: 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
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 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3696 3696
3697 /////////////////////////////////////////////////////////////////////////////// 3697 ///////////////////////////////////////////////////////////////////////////////
3698 // Browser, BookmarkTabHelperDelegate implementation: 3698 // Browser, BookmarkTabHelperDelegate implementation:
3699 3699
3700 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) { 3700 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) {
3701 if (source == GetSelectedTabContentsWrapper()) 3701 if (source == GetSelectedTabContentsWrapper())
3702 window_->SetStarredState(starred); 3702 window_->SetStarredState(starred);
3703 } 3703 }
3704 3704
3705 /////////////////////////////////////////////////////////////////////////////// 3705 ///////////////////////////////////////////////////////////////////////////////
3706 // Browser, ZoomTabHelperDelegate implementation:
3707
3708 void Browser::ZoomIconStateChanged(TabContentsWrapper *source,
3709 ZoomTabHelper::ZoomIconState state,
3710 int zoomPercent) {
3711 if (source == GetSelectedTabContentsWrapper())
3712 window_->SetZoomIconState(state, zoomPercent);
3713 }
3714
3715 void Browser::ZoomChanged(TabContentsWrapper *source,
3716 int zoomPercent) {
3717 if (source == GetSelectedTabContentsWrapper() && window_->IsActive())
3718 window_->ShowZoomBubble(zoomPercent);
3719 }
3720
3721 ///////////////////////////////////////////////////////////////////////////////
3706 // Browser, ExtensionTabHelperDelegate implementation: 3722 // Browser, ExtensionTabHelperDelegate implementation:
3707 3723
3708 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, 3724 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source,
3709 int32 page_id) { 3725 int32 page_id) {
3710 if (GetSelectedTabContentsWrapper() != source) 3726 if (GetSelectedTabContentsWrapper() != source)
3711 return; 3727 return;
3712 3728
3713 NavigationEntry* entry = 3729 NavigationEntry* entry =
3714 source->web_contents()->GetController().GetLastCommittedEntry(); 3730 source->web_contents()->GetController().GetLastCommittedEntry();
3715 if (!entry || (entry->GetPageID() != page_id)) 3731 if (!entry || (entry->GetPageID() != page_id))
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
4176 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, 4192 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
4177 CanReloadContents(current_tab)); 4193 CanReloadContents(current_tab));
4178 4194
4179 // Window management commands 4195 // Window management commands
4180 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 4196 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
4181 !is_app() && CanDuplicateContentsAt(active_index())); 4197 !is_app() && CanDuplicateContentsAt(active_index()));
4182 4198
4183 // Page-related commands 4199 // Page-related commands
4184 window_->SetStarredState( 4200 window_->SetStarredState(
4185 current_tab_wrapper->bookmark_tab_helper()->is_starred()); 4201 current_tab_wrapper->bookmark_tab_helper()->is_starred());
4202 window_->SetZoomIconState(
4203 current_tab_wrapper->zoom_tab_helper()->zoom_icon_status(),
4204 current_tab_wrapper->zoom_tab_helper()->zoom_percent());
4186 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 4205 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
4187 current_tab->GetController().CanViewSource()); 4206 current_tab->GetController().CanViewSource());
4188 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, 4207 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
4189 toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid()); 4208 toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid());
4190 if (is_devtools()) 4209 if (is_devtools())
4191 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false); 4210 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
4192 4211
4193 // Changing the encoding is not possible on Chrome-internal webpages. 4212 // Changing the encoding is not possible on Chrome-internal webpages.
4194 bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) || 4213 bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) ||
4195 current_tab->ShowingInterstitialPage(); 4214 current_tab->ShowingInterstitialPage();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4672 /////////////////////////////////////////////////////////////////////////////// 4691 ///////////////////////////////////////////////////////////////////////////////
4673 // Browser, Assorted utility functions (private): 4692 // Browser, Assorted utility functions (private):
4674 4693
4675 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { 4694 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) {
4676 // WebContents... 4695 // WebContents...
4677 tab->web_contents()->SetDelegate(delegate); 4696 tab->web_contents()->SetDelegate(delegate);
4678 4697
4679 // ...and all the helpers. 4698 // ...and all the helpers.
4680 tab->blocked_content_tab_helper()->set_delegate(delegate); 4699 tab->blocked_content_tab_helper()->set_delegate(delegate);
4681 tab->bookmark_tab_helper()->set_delegate(delegate); 4700 tab->bookmark_tab_helper()->set_delegate(delegate);
4701 tab->zoom_tab_helper()->set_delegate(delegate);
4682 tab->constrained_window_tab_helper()->set_delegate(delegate); 4702 tab->constrained_window_tab_helper()->set_delegate(delegate);
4683 tab->core_tab_helper()->set_delegate(delegate); 4703 tab->core_tab_helper()->set_delegate(delegate);
4684 tab->extension_tab_helper()->set_delegate(delegate); 4704 tab->extension_tab_helper()->set_delegate(delegate);
4685 tab->search_engine_tab_helper()->set_delegate(delegate); 4705 tab->search_engine_tab_helper()->set_delegate(delegate);
4686 } 4706 }
4687 4707
4688 void Browser::FindInPage(bool find_next, bool forward_direction) { 4708 void Browser::FindInPage(bool find_next, bool forward_direction) {
4689 ShowFindBar(); 4709 ShowFindBar();
4690 if (find_next) { 4710 if (find_next) {
4691 string16 find_text; 4711 string16 find_text;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5110 if (contents && !allow_js_access) { 5130 if (contents && !allow_js_access) {
5111 contents->web_contents()->GetController().LoadURL( 5131 contents->web_contents()->GetController().LoadURL(
5112 target_url, 5132 target_url,
5113 content::Referrer(), 5133 content::Referrer(),
5114 content::PAGE_TRANSITION_LINK, 5134 content::PAGE_TRANSITION_LINK,
5115 std::string()); // No extra headers. 5135 std::string()); // No extra headers.
5116 } 5136 }
5117 5137
5118 return contents != NULL; 5138 return contents != NULL;
5119 } 5139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698