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

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

Issue 2876223003: cocoa: add some tab-manipulation menu items (Closed)
Patch Set: remove top separator 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/metrics/user_metrics.h" 9 #include "base/metrics/user_metrics.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 733
734 bool CanDuplicateTabAt(const Browser* browser, int index) { 734 bool CanDuplicateTabAt(const Browser* browser, int index) {
735 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(index); 735 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(index);
736 // If an interstitial is showing, do not allow tab duplication, since 736 // If an interstitial is showing, do not allow tab duplication, since
737 // the last committed entry is what would get duplicated and is not 737 // the last committed entry is what would get duplicated and is not
738 // what the user expects to duplicate. 738 // what the user expects to duplicate.
739 return contents && !contents->ShowingInterstitialPage() && 739 return contents && !contents->ShowingInterstitialPage() &&
740 contents->GetController().GetLastCommittedEntry(); 740 contents->GetController().GetLastCommittedEntry();
741 } 741 }
742 742
743 void PinTab(Browser* browser) {
744 browser->tab_strip_model()->ExecuteContextMenuCommand(
745 browser->tab_strip_model()->active_index(),
746 TabStripModel::ContextMenuCommand::CommandTogglePinned);
747 }
748
749 void MuteTab(Browser* browser) {
750 browser->tab_strip_model()->ExecuteContextMenuCommand(
751 browser->tab_strip_model()->active_index(),
752 TabStripModel::ContextMenuCommand::CommandToggleTabAudioMuted);
753 }
754
743 void ConvertPopupToTabbedBrowser(Browser* browser) { 755 void ConvertPopupToTabbedBrowser(Browser* browser) {
744 base::RecordAction(UserMetricsAction("ShowAsTab")); 756 base::RecordAction(UserMetricsAction("ShowAsTab"));
745 TabStripModel* tab_strip = browser->tab_strip_model(); 757 TabStripModel* tab_strip = browser->tab_strip_model();
746 WebContents* contents = 758 WebContents* contents =
747 tab_strip->DetachWebContentsAt(tab_strip->active_index()); 759 tab_strip->DetachWebContentsAt(tab_strip->active_index());
748 Browser* b = new Browser(Browser::CreateParams(browser->profile(), true)); 760 Browser* b = new Browser(Browser::CreateParams(browser->profile(), true));
749 b->tab_strip_model()->AppendWebContents(contents, true); 761 b->tab_strip_model()->AppendWebContents(contents, true);
750 b->window()->Show(); 762 b->window()->Show();
751 } 763 }
752 764
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 } 1310 }
1299 1311
1300 bool CanCreateBookmarkApp(const Browser* browser) { 1312 bool CanCreateBookmarkApp(const Browser* browser) {
1301 return extensions::TabHelper::FromWebContents( 1313 return extensions::TabHelper::FromWebContents(
1302 browser->tab_strip_model()->GetActiveWebContents()) 1314 browser->tab_strip_model()->GetActiveWebContents())
1303 ->CanCreateBookmarkApp(); 1315 ->CanCreateBookmarkApp();
1304 } 1316 }
1305 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 1317 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
1306 1318
1307 } // namespace chrome 1319 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/cocoa/browser_window_command_handler.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698