blob: ef35eecf7300904e05b531ee5849f8af3e088694 [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]a37d4b02012-06-25 21:56:1010#include "chrome/browser/debugger/devtools_toggle_action.h"
11#include "content/public/common/page_zoom.h"
12#include "webkit/glue/window_open_disposition.h"
13
14class Browser;
[email protected]5d98294912012-06-27 22:57:4015class CommandObserver;
[email protected]a37d4b02012-06-25 21:56:1016class GURL;
17class Profile;
[email protected]2cd4fde2012-06-26 03:10:2618class TabContents;
[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);
43
44// Opens a new window with the default blank tab. This bypasses metrics and
45// various internal bookkeeping; NewEmptyWindow (above) is preferred.
46Browser* OpenEmptyWindow(Profile* profile);
47
48// Opens a new window with the tabs from |profile|'s TabRestoreService.
49void OpenWindowWithRestoredTabs(Profile* profile);
50
51// Opens the specified URL in a new browser window in an incognito session.
52// If there is already an existing active incognito session for the specified
53// |profile|, that session is re-used.
54void OpenURLOffTheRecord(Profile* profile, const GURL& url);
55
[email protected]5d98294912012-06-27 22:57:4056bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1057void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4058bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1059void GoForward(Browser* browser, WindowOpenDisposition disposition);
60bool NavigateToIndexWithDisposition(Browser* browser,
61 int index,
62 WindowOpenDisposition disp);
63void Reload(Browser* browser, WindowOpenDisposition disposition);
64void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4065bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1066void Home(Browser* browser, WindowOpenDisposition disposition);
67void OpenCurrentURL(Browser* browser);
68void Stop(Browser* browser);
69void NewWindow(Browser* browser);
70void NewIncognitoWindow(Browser* browser);
71void CloseWindow(Browser* browser);
72void NewTab(Browser* browser);
73void CloseTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4074void RestoreTab(Browser* browser);
75bool CanRestoreTab(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1076void SelectNextTab(Browser* browser);
77void SelectPreviousTab(Browser* browser);
78void OpenTabpose(Browser* browser); // Mac-only
79void MoveTabNext(Browser* browser);
80void MoveTabPrevious(Browser* browser);
81void SelectNumberedTab(Browser* browser, int index);
82void SelectLastTab(Browser* browser);
83void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4084bool CanDuplicateTab(const Browser* browser);
[email protected]37bb5822012-09-10 15:09:5785TabContents* DuplicateTabAt(Browser* browser, int index);
[email protected]855370052012-07-10 19:30:3286bool CanDuplicateTabAt(Browser* browser, int index);
[email protected]a37d4b02012-06-25 21:56:1087void ConvertPopupToTabbedBrowser(Browser* browser);
88void Exit();
89void BookmarkCurrentPage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4090bool CanBookmarkCurrentPage(const Browser* browser);
91void BookmarkAllTabs(Browser* browser);
92bool CanBookmarkAllTabs(const Browser* browser);
[email protected]ffe6de62012-07-19 00:02:3593void TogglePagePinnedToStartScreen(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1094void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4095bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1096void ShowFindBar(Browser* browser);
97void ShowPageInfo(Browser* browser,
98 content::WebContents* web_contents,
99 const GURL& url,
100 const content::SSLStatus& ssl,
101 bool show_history);
102void ShowChromeToMobileBubble(Browser* browser);
[email protected]6c2d6eb2012-09-01 00:06:31103void ShareCurrentPage(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10104void Print(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40105bool CanPrint(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10106void AdvancedPrint(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40107bool CanAdvancedPrint(const Browser* browser);
[email protected]d53e4032012-06-29 18:58:34108void PrintToDestination(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10109void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40110bool CanEmailPageLocation(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10111void Cut(Browser* browser);
112void Copy(Browser* browser);
113void Paste(Browser* browser);
114void Find(Browser* browser);
115void FindNext(Browser* browser);
116void FindPrevious(Browser* browser);
117void FindInPage(Browser* browser, bool find_next, bool forward_direction);
118void Zoom(Browser* browser, content::PageZoom zoom);
119void FocusToolbar(Browser* browser);
120void FocusLocationBar(Browser* browser);
121void FocusSearch(Browser* browser);
122void FocusAppMenu(Browser* browser);
123void FocusBookmarksToolbar(Browser* browser);
124void FocusNextPane(Browser* browser);
125void FocusPreviousPane(Browser* browser);
126void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
127bool CanOpenTaskManager();
128void OpenTaskManager(Browser* browser, bool highlight_background_resources);
129void OpenFeedbackDialog(Browser* browser);
130void ToggleBookmarkBar(Browser* browser);
131void ShowAppMenu(Browser* browser);
132void ShowAvatarMenu(Browser* browser);
133void OpenUpdateChromeDialog(Browser* browser);
134void ToggleSpeechInput(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36135bool CanRequestTabletSite(content::WebContents* current_tab);
136bool IsRequestingTabletSite(Browser* browser);
137void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28138void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39139void ClearCache(Browser* browser);
140bool IsDebuggerAttachedToCurrentTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10141
[email protected]2cd4fde2012-06-26 03:10:26142// Opens view-source tab for given tab contents.
143void ViewSource(Browser* browser, TabContents* tab);
144
145// Opens view-source tab for any frame within given tab contents.
146void ViewSource(Browser* browser,
147 TabContents* tab,
148 const GURL& url,
149 const std::string& content_state);
150
151void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40152bool CanViewSource(const Browser* browser);
153
[email protected]619f86182012-07-03 21:30:18154void CreateApplicationShortcuts(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40155bool CanCreateApplicationShortcuts(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26156
[email protected]40df6f52012-06-28 17:08:52157void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
158
[email protected]a37d4b02012-06-25 21:56:10159} // namespace chrome
160
161#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_