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

Side by Side Diff: chrome/browser/ui/browser_command_controller.cc

Issue 2876223003: cocoa: add some tab-manipulation menu items (Closed)
Patch Set: unstage nib delta Created 3 years, 7 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_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 launchable->Launch(mash::mojom::kWindow, 638 launchable->Launch(mash::mojom::kWindow,
639 mash::mojom::LaunchMode::DEFAULT); 639 mash::mojom::LaunchMode::DEFAULT);
640 } else { 640 } else {
641 ash::accelerators::ToggleTouchHudProjection(); 641 ash::accelerators::ToggleTouchHudProjection();
642 } 642 }
643 break; 643 break;
644 #endif 644 #endif
645 case IDC_ROUTE_MEDIA: 645 case IDC_ROUTE_MEDIA:
646 RouteMedia(browser_); 646 RouteMedia(browser_);
647 break; 647 break;
648 648
Robert Sesek 2017/05/16 19:47:41 nit: remove blank line (not present between other
Elly Fong-Jones 2017/05/17 17:56:16 Done.
649 case IDC_WINDOW_MUTE_TAB:
650 MuteTab(browser_);
651 break;
652 case IDC_WINDOW_PIN_TAB:
653 PinTab(browser_);
654 break;
655
649 default: 656 default:
650 LOG(WARNING) << "Received Unimplemented Command: " << id; 657 LOG(WARNING) << "Received Unimplemented Command: " << id;
651 break; 658 break;
652 } 659 }
653 } 660 }
654 661
655 //////////////////////////////////////////////////////////////////////////////// 662 ////////////////////////////////////////////////////////////////////////////////
656 // BrowserCommandController, SigninPrefObserver implementation: 663 // BrowserCommandController, SigninPrefObserver implementation:
657 664
658 void BrowserCommandController::OnSigninAllowedPrefChange() { 665 void BrowserCommandController::OnSigninAllowedPrefChange() {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 843
837 // These are always enabled; the menu determines their menu item visibility. 844 // These are always enabled; the menu determines their menu item visibility.
838 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); 845 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true);
839 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); 846 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true);
840 847
841 // Distill current page. 848 // Distill current page.
842 command_updater_.UpdateCommandEnabled( 849 command_updater_.UpdateCommandEnabled(
843 IDC_DISTILL_PAGE, base::CommandLine::ForCurrentProcess()->HasSwitch( 850 IDC_DISTILL_PAGE, base::CommandLine::ForCurrentProcess()->HasSwitch(
844 switches::kEnableDomDistiller)); 851 switches::kEnableDomDistiller));
845 852
853 command_updater_.UpdateCommandEnabled(IDC_WINDOW_MUTE_TAB, normal_window);
854 command_updater_.UpdateCommandEnabled(IDC_WINDOW_PIN_TAB, normal_window);
855
846 // Initialize other commands whose state changes based on various conditions. 856 // Initialize other commands whose state changes based on various conditions.
847 UpdateCommandsForFullscreenMode(); 857 UpdateCommandsForFullscreenMode();
848 UpdateCommandsForContentRestrictionState(); 858 UpdateCommandsForContentRestrictionState();
849 UpdateCommandsForBookmarkEditing(); 859 UpdateCommandsForBookmarkEditing();
850 UpdateCommandsForIncognitoAvailability(); 860 UpdateCommandsForIncognitoAvailability();
851 } 861 }
852 862
853 // static 863 // static
854 void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability( 864 void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability(
855 CommandUpdater* command_updater, 865 CommandUpdater* command_updater,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); 921 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_));
912 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); 922 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_));
913 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, 923 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE,
914 CanReload(browser_)); 924 CanReload(browser_));
915 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, 925 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE,
916 CanReload(browser_)); 926 CanReload(browser_));
917 927
918 // Window management commands 928 // Window management commands
919 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 929 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
920 !browser_->is_app() && CanDuplicateTab(browser_)); 930 !browser_->is_app() && CanDuplicateTab(browser_));
931 command_updater_.UpdateCommandEnabled(IDC_WINDOW_MUTE_TAB,
932 !browser_->is_app());
933 command_updater_.UpdateCommandEnabled(IDC_WINDOW_PIN_TAB,
934 !browser_->is_app());
921 935
922 // Page-related commands 936 // Page-related commands
923 window()->SetStarredState( 937 window()->SetStarredState(
924 BookmarkTabHelper::FromWebContents(current_web_contents)->is_starred()); 938 BookmarkTabHelper::FromWebContents(current_web_contents)->is_starred());
925 window()->ZoomChangedForActiveTab(false); 939 window()->ZoomChangedForActiveTab(false);
926 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 940 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
927 CanViewSource(browser_)); 941 CanViewSource(browser_));
928 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, 942 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
929 CanEmailPageLocation(browser_)); 943 CanEmailPageLocation(browser_));
930 if (browser_->is_devtools()) 944 if (browser_->is_devtools())
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 1164
1151 BrowserWindow* BrowserCommandController::window() { 1165 BrowserWindow* BrowserCommandController::window() {
1152 return browser_->window(); 1166 return browser_->window();
1153 } 1167 }
1154 1168
1155 Profile* BrowserCommandController::profile() { 1169 Profile* BrowserCommandController::profile() {
1156 return browser_->profile(); 1170 return browser_->profile();
1157 } 1171 }
1158 1172
1159 } // namespace chrome 1173 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698