blob: 477291c983fcda9d4eddc86d9043850e7d4db34b [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]855370052012-07-10 19:30:3285void DuplicateTabAt(Browser* browser, int index);
86bool 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);
103void Print(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40104bool CanPrint(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10105void AdvancedPrint(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40106bool CanAdvancedPrint(const Browser* browser);
[email protected]d53e4032012-06-29 18:58:34107void PrintToDestination(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10108void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40109bool CanEmailPageLocation(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10110void Cut(Browser* browser);
111void Copy(Browser* browser);
112void Paste(Browser* browser);
113void Find(Browser* browser);
114void FindNext(Browser* browser);
115void FindPrevious(Browser* browser);
116void FindInPage(Browser* browser, bool find_next, bool forward_direction);
117void Zoom(Browser* browser, content::PageZoom zoom);
118void FocusToolbar(Browser* browser);
119void FocusLocationBar(Browser* browser);
120void FocusSearch(Browser* browser);
121void FocusAppMenu(Browser* browser);
122void FocusBookmarksToolbar(Browser* browser);
123void FocusNextPane(Browser* browser);
124void FocusPreviousPane(Browser* browser);
125void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
126bool CanOpenTaskManager();
127void OpenTaskManager(Browser* browser, bool highlight_background_resources);
128void OpenFeedbackDialog(Browser* browser);
129void ToggleBookmarkBar(Browser* browser);
130void ShowAppMenu(Browser* browser);
131void ShowAvatarMenu(Browser* browser);
132void OpenUpdateChromeDialog(Browser* browser);
133void ToggleSpeechInput(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28134void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39135void ClearCache(Browser* browser);
136bool IsDebuggerAttachedToCurrentTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10137
[email protected]2cd4fde2012-06-26 03:10:26138// Opens view-source tab for given tab contents.
139void ViewSource(Browser* browser, TabContents* tab);
140
141// Opens view-source tab for any frame within given tab contents.
142void ViewSource(Browser* browser,
143 TabContents* tab,
144 const GURL& url,
145 const std::string& content_state);
146
147void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40148bool CanViewSource(const Browser* browser);
149
[email protected]619f86182012-07-03 21:30:18150void CreateApplicationShortcuts(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40151bool CanCreateApplicationShortcuts(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26152
[email protected]40df6f52012-06-28 17:08:52153void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
154
[email protected]a37d4b02012-06-25 21:56:10155} // namespace chrome
156
157#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_