blob: 41a7f91433fb3727943a78b8add61871a8f427b2 [file] [log] [blame]
[email protected]a37d4b02012-06-25 21:56:101// 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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_BROWSER_COMMANDS_H_
6#define CHROME_BROWSER_UI_BROWSER_COMMANDS_H_
[email protected]a37d4b02012-06-25 21:56:107
[email protected]2cd4fde2012-06-26 03:10:268#include <string>
9
[email protected]70019152012-12-19 11:44:1910#include "chrome/browser/devtools/devtools_toggle_action.h"
[email protected]3b14b7f22012-10-04 01:29:0911#include "chrome/browser/ui/host_desktop.h"
[email protected]a37d4b02012-06-25 21:56:1012#include "content/public/common/page_zoom.h"
[email protected]f47621b2013-01-22 20:50:3313#include "ui/base/window_open_disposition.h"
[email protected]a37d4b02012-06-25 21:56:1014
15class Browser;
[email protected]5d98294912012-06-27 22:57:4016class CommandObserver;
[email protected]a37d4b02012-06-25 21:56:1017class GURL;
18class Profile;
[email protected]a37d4b02012-06-25 21:56:1019
20namespace content {
21class WebContents;
22struct SSLStatus;
23}
24
25namespace chrome {
26
[email protected]5d98294912012-06-27 22:57:4027// For all commands, where a tab is not specified, the active tab is assumed.
28
29bool IsCommandEnabled(Browser* browser, int command);
30bool SupportsCommand(Browser* browser, int command);
31bool ExecuteCommand(Browser* browser, int command);
32bool ExecuteCommandWithDisposition(Browser* browser,
33 int command,
34 WindowOpenDisposition disposition);
35void UpdateCommandEnabled(Browser* browser, int command, bool enabled);
36void AddCommandObserver(Browser*, int command, CommandObserver* observer);
37void RemoveCommandObserver(Browser*, int command, CommandObserver* observer);
38
39int GetContentRestrictions(const Browser* browser);
40
[email protected]a37d4b02012-06-25 21:56:1041// Opens a new window with the default blank tab.
42void NewEmptyWindow(Profile* profile);
[email protected]5fdb45b2012-10-23 20:26:2843void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1044
45// Opens a new window with the default blank tab. This bypasses metrics and
46// various internal bookkeeping; NewEmptyWindow (above) is preferred.
47Browser* OpenEmptyWindow(Profile* profile);
[email protected]5fdb45b2012-10-23 20:26:2848Browser* OpenEmptyWindow(Profile* profile, HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1049
50// Opens a new window with the tabs from |profile|'s TabRestoreService.
[email protected]3b265312013-01-17 02:49:5551void OpenWindowWithRestoredTabs(Profile* profile,
52 HostDesktopType host_desktop_type);
[email protected]a37d4b02012-06-25 21:56:1053
[email protected]3b14b7f22012-10-04 01:29:0954// Opens the specified URL in a new browser window in an incognito session on
55// the desktop specified by |desktop_type|. If there is already an existing
56// active incognito session for the specified |profile|, that session is re-
57// used.
58void OpenURLOffTheRecord(Profile* profile, const GURL& url,
59 chrome::HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1060
[email protected]5d98294912012-06-27 22:57:4061bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1062void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4063bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1064void GoForward(Browser* browser, WindowOpenDisposition disposition);
65bool NavigateToIndexWithDisposition(Browser* browser,
66 int index,
67 WindowOpenDisposition disp);
68void Reload(Browser* browser, WindowOpenDisposition disposition);
69void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4070bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1071void Home(Browser* browser, WindowOpenDisposition disposition);
72void OpenCurrentURL(Browser* browser);
73void Stop(Browser* browser);
74void NewWindow(Browser* browser);
75void NewIncognitoWindow(Browser* browser);
76void CloseWindow(Browser* browser);
77void NewTab(Browser* browser);
78void CloseTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4079void RestoreTab(Browser* browser);
80bool CanRestoreTab(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1081void SelectNextTab(Browser* browser);
82void SelectPreviousTab(Browser* browser);
83void OpenTabpose(Browser* browser); // Mac-only
84void MoveTabNext(Browser* browser);
85void MoveTabPrevious(Browser* browser);
86void SelectNumberedTab(Browser* browser, int index);
87void SelectLastTab(Browser* browser);
88void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4089bool CanDuplicateTab(const Browser* browser);
[email protected]ab93b6372012-11-28 05:20:2290content::WebContents* DuplicateTabAt(Browser* browser, int index);
[email protected]855370052012-07-10 19:30:3291bool CanDuplicateTabAt(Browser* browser, int index);
[email protected]a37d4b02012-06-25 21:56:1092void ConvertPopupToTabbedBrowser(Browser* browser);
93void Exit();
94void BookmarkCurrentPage(Browser* browser);
[email protected]195c99c2012-10-31 06:24:5195void BookmarkCurrentPageFromStar(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4096bool CanBookmarkCurrentPage(const Browser* browser);
97void BookmarkAllTabs(Browser* browser);
98bool CanBookmarkAllTabs(const Browser* browser);
[email protected]ffe6de62012-07-19 00:02:3599void TogglePagePinnedToStartScreen(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10100void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40101bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10102void ShowFindBar(Browser* browser);
[email protected]2285262d2013-01-24 16:19:35103void ShowWebsiteSettings(Browser* browser,
104 content::WebContents* web_contents,
105 const GURL& url,
106 const content::SSLStatus& ssl,
107 bool show_history);
[email protected]a37d4b02012-06-25 21:56:10108void ShowChromeToMobileBubble(Browser* browser);
109void Print(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40110bool CanPrint(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10111void AdvancedPrint(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40112bool CanAdvancedPrint(const Browser* browser);
[email protected]d53e4032012-06-29 18:58:34113void PrintToDestination(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10114void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40115bool CanEmailPageLocation(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10116void Cut(Browser* browser);
117void Copy(Browser* browser);
118void Paste(Browser* browser);
119void Find(Browser* browser);
120void FindNext(Browser* browser);
121void FindPrevious(Browser* browser);
122void FindInPage(Browser* browser, bool find_next, bool forward_direction);
123void Zoom(Browser* browser, content::PageZoom zoom);
124void FocusToolbar(Browser* browser);
125void FocusLocationBar(Browser* browser);
126void FocusSearch(Browser* browser);
127void FocusAppMenu(Browser* browser);
128void FocusBookmarksToolbar(Browser* browser);
129void FocusNextPane(Browser* browser);
130void FocusPreviousPane(Browser* browser);
131void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
132bool CanOpenTaskManager();
133void OpenTaskManager(Browser* browser, bool highlight_background_resources);
134void OpenFeedbackDialog(Browser* browser);
135void ToggleBookmarkBar(Browser* browser);
136void ShowAppMenu(Browser* browser);
137void ShowAvatarMenu(Browser* browser);
138void OpenUpdateChromeDialog(Browser* browser);
139void ToggleSpeechInput(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36140bool CanRequestTabletSite(content::WebContents* current_tab);
141bool IsRequestingTabletSite(Browser* browser);
142void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28143void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39144void ClearCache(Browser* browser);
145bool IsDebuggerAttachedToCurrentTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10146
[email protected]ab93b6372012-11-28 05:20:22147// Opens a view-source tab for a given web contents.
148void ViewSource(Browser* browser, content::WebContents* tab);
[email protected]2cd4fde2012-06-26 03:10:26149
[email protected]ab93b6372012-11-28 05:20:22150// Opens a view-source tab for any frame within a given web contents.
[email protected]2cd4fde2012-06-26 03:10:26151void ViewSource(Browser* browser,
[email protected]ab93b6372012-11-28 05:20:22152 content::WebContents* tab,
[email protected]2cd4fde2012-06-26 03:10:26153 const GURL& url,
154 const std::string& content_state);
155
156void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40157bool CanViewSource(const Browser* browser);
158
[email protected]619f86182012-07-03 21:30:18159void CreateApplicationShortcuts(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40160bool CanCreateApplicationShortcuts(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26161
[email protected]40df6f52012-06-28 17:08:52162void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
163
[email protected]a37d4b02012-06-25 21:56:10164} // namespace chrome
165
166#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_