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

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: Changed delegate to observer 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 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after
3700 3700
3701 /////////////////////////////////////////////////////////////////////////////// 3701 ///////////////////////////////////////////////////////////////////////////////
3702 // Browser, BookmarkTabHelperDelegate implementation: 3702 // Browser, BookmarkTabHelperDelegate implementation:
3703 3703
3704 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) { 3704 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) {
3705 if (source == GetSelectedTabContentsWrapper()) 3705 if (source == GetSelectedTabContentsWrapper())
3706 window_->SetStarredState(starred); 3706 window_->SetStarredState(starred);
3707 } 3707 }
3708 3708
3709 /////////////////////////////////////////////////////////////////////////////// 3709 ///////////////////////////////////////////////////////////////////////////////
3710 // Browser, ZoomObserver implementation:
3711
3712 void Browser::OnZoomIconChanged(TabContentsWrapper* source,
3713 ZoomController::ZoomIconState state) {
3714 if (source == GetSelectedTabContentsWrapper())
3715 window_->SetZoomIconState(state);
3716 }
3717
3718 void Browser::OnZoomChanged(TabContentsWrapper* source,
3719 int zoom_percent) {
3720 if (source == GetSelectedTabContentsWrapper()) {
3721 window_->SetZoomIconTooltipPercent(zoom_percent);
3722
3723 // Only show the zoom bubble for zoom changes in the active window.
3724 if (window_->IsActive())
3725 window_->ShowZoomBubble(zoom_percent);
3726 }
3727 }
3728
3729 ///////////////////////////////////////////////////////////////////////////////
3710 // Browser, ExtensionTabHelperDelegate implementation: 3730 // Browser, ExtensionTabHelperDelegate implementation:
3711 3731
3712 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, 3732 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source,
3713 int32 page_id) { 3733 int32 page_id) {
3714 if (GetSelectedTabContentsWrapper() != source) 3734 if (GetSelectedTabContentsWrapper() != source)
3715 return; 3735 return;
3716 3736
3717 NavigationEntry* entry = 3737 NavigationEntry* entry =
3718 source->web_contents()->GetController().GetLastCommittedEntry(); 3738 source->web_contents()->GetController().GetLastCommittedEntry();
3719 if (!entry || (entry->GetPageID() != page_id)) 3739 if (!entry || (entry->GetPageID() != page_id))
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, 4203 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
4184 CanReloadContents(current_tab)); 4204 CanReloadContents(current_tab));
4185 4205
4186 // Window management commands 4206 // Window management commands
4187 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 4207 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
4188 !is_app() && CanDuplicateContentsAt(active_index())); 4208 !is_app() && CanDuplicateContentsAt(active_index()));
4189 4209
4190 // Page-related commands 4210 // Page-related commands
4191 window_->SetStarredState( 4211 window_->SetStarredState(
4192 current_tab_wrapper->bookmark_tab_helper()->is_starred()); 4212 current_tab_wrapper->bookmark_tab_helper()->is_starred());
4213 window_->SetZoomIconState(
4214 current_tab_wrapper->zoom_controller()->zoom_icon_state());
4215 window_->SetZoomIconTooltipPercent(
4216 current_tab_wrapper->zoom_controller()->zoom_percent());
4193 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 4217 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
4194 current_tab->GetController().CanViewSource()); 4218 current_tab->GetController().CanViewSource());
4195 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, 4219 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
4196 toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid()); 4220 toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid());
4197 if (is_devtools()) 4221 if (is_devtools())
4198 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false); 4222 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
4199 4223
4200 // Changing the encoding is not possible on Chrome-internal webpages. 4224 // Changing the encoding is not possible on Chrome-internal webpages.
4201 bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) || 4225 bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) ||
4202 current_tab->ShowingInterstitialPage(); 4226 current_tab->ShowingInterstitialPage();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4679 /////////////////////////////////////////////////////////////////////////////// 4703 ///////////////////////////////////////////////////////////////////////////////
4680 // Browser, Assorted utility functions (private): 4704 // Browser, Assorted utility functions (private):
4681 4705
4682 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { 4706 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) {
4683 // WebContents... 4707 // WebContents...
4684 tab->web_contents()->SetDelegate(delegate); 4708 tab->web_contents()->SetDelegate(delegate);
4685 4709
4686 // ...and all the helpers. 4710 // ...and all the helpers.
4687 tab->blocked_content_tab_helper()->set_delegate(delegate); 4711 tab->blocked_content_tab_helper()->set_delegate(delegate);
4688 tab->bookmark_tab_helper()->set_delegate(delegate); 4712 tab->bookmark_tab_helper()->set_delegate(delegate);
4713 tab->zoom_controller()->set_observer(delegate);
4689 tab->constrained_window_tab_helper()->set_delegate(delegate); 4714 tab->constrained_window_tab_helper()->set_delegate(delegate);
4690 tab->core_tab_helper()->set_delegate(delegate); 4715 tab->core_tab_helper()->set_delegate(delegate);
4691 tab->extension_tab_helper()->set_delegate(delegate); 4716 tab->extension_tab_helper()->set_delegate(delegate);
4692 tab->search_engine_tab_helper()->set_delegate(delegate); 4717 tab->search_engine_tab_helper()->set_delegate(delegate);
4693 } 4718 }
4694 4719
4695 void Browser::FindInPage(bool find_next, bool forward_direction) { 4720 void Browser::FindInPage(bool find_next, bool forward_direction) {
4696 ShowFindBar(); 4721 ShowFindBar();
4697 if (find_next) { 4722 if (find_next) {
4698 string16 find_text; 4723 string16 find_text;
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
5116 if (contents && !allow_js_access) { 5141 if (contents && !allow_js_access) {
5117 contents->web_contents()->GetController().LoadURL( 5142 contents->web_contents()->GetController().LoadURL(
5118 target_url, 5143 target_url,
5119 content::Referrer(), 5144 content::Referrer(),
5120 content::PAGE_TRANSITION_LINK, 5145 content::PAGE_TRANSITION_LINK,
5121 std::string()); // No extra headers. 5146 std::string()); // No extra headers.
5122 } 5147 }
5123 5148
5124 return contents != NULL; 5149 return contents != NULL;
5125 } 5150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698