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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_BROWSER_COMMANDS_H_
6 #define CHROME_BROWSER_UI_BROWSER_COMMANDS_H_
10 #include "chrome/browser/devtools/devtools_toggle_action.h"
11 #include "chrome/browser/ui/host_desktop.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
13 #include "content/public/common/page_zoom.h"
14 #include "ui/base/window_open_disposition.h"
17 class CommandObserver
;
29 // For all commands, where a tab is not specified, the active tab is assumed.
31 bool IsCommandEnabled(Browser
* browser
, int command
);
32 bool SupportsCommand(Browser
* browser
, int command
);
33 bool ExecuteCommand(Browser
* browser
, int command
);
34 bool ExecuteCommandWithDisposition(Browser
* browser
,
36 WindowOpenDisposition disposition
);
37 void UpdateCommandEnabled(Browser
* browser
, int command
, bool enabled
);
38 void AddCommandObserver(Browser
*, int command
, CommandObserver
* observer
);
39 void RemoveCommandObserver(Browser
*, int command
, CommandObserver
* observer
);
41 int GetContentRestrictions(const Browser
* browser
);
43 // Opens a new window with the default blank tab.
44 void NewEmptyWindow(Profile
* profile
, HostDesktopType desktop_type
);
46 // Opens a new window with the default blank tab. This bypasses metrics and
47 // various internal bookkeeping; NewEmptyWindow (above) is preferred.
48 Browser
* OpenEmptyWindow(Profile
* profile
, HostDesktopType desktop_type
);
50 // Opens a new window with the tabs from |profile|'s TabRestoreService.
51 void OpenWindowWithRestoredTabs(Profile
* profile
,
52 HostDesktopType host_desktop_type
);
54 // 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-
58 void OpenURLOffTheRecord(Profile
* profile
, const GURL
& url
,
59 chrome::HostDesktopType desktop_type
);
61 bool CanGoBack(const Browser
* browser
);
62 void GoBack(Browser
* browser
, WindowOpenDisposition disposition
);
63 bool CanGoForward(const Browser
* browser
);
64 void GoForward(Browser
* browser
, WindowOpenDisposition disposition
);
65 bool NavigateToIndexWithDisposition(Browser
* browser
,
67 WindowOpenDisposition disp
);
68 void Reload(Browser
* browser
, WindowOpenDisposition disposition
);
69 void ReloadIgnoringCache(Browser
* browser
, WindowOpenDisposition disposition
);
70 bool CanReload(const Browser
* browser
);
71 void Home(Browser
* browser
, WindowOpenDisposition disposition
);
72 void OpenCurrentURL(Browser
* browser
);
73 void Stop(Browser
* browser
);
74 void NewWindow(Browser
* browser
);
75 void NewIncognitoWindow(Browser
* browser
);
76 void CloseWindow(Browser
* browser
);
77 void NewTab(Browser
* browser
);
78 void CloseTab(Browser
* browser
);
79 void RestoreTab(Browser
* browser
);
80 TabStripModelDelegate::RestoreTabType
GetRestoreTabType(
81 const Browser
* browser
);
82 void SelectNextTab(Browser
* browser
);
83 void SelectPreviousTab(Browser
* browser
);
84 void OpenTabpose(Browser
* browser
); // Mac-only
85 void MoveTabNext(Browser
* browser
);
86 void MoveTabPrevious(Browser
* browser
);
87 void SelectNumberedTab(Browser
* browser
, int index
);
88 void SelectLastTab(Browser
* browser
);
89 void DuplicateTab(Browser
* browser
);
90 bool CanDuplicateTab(const Browser
* browser
);
91 content::WebContents
* DuplicateTabAt(Browser
* browser
, int index
);
92 bool CanDuplicateTabAt(Browser
* browser
, int index
);
93 void ConvertPopupToTabbedBrowser(Browser
* browser
);
95 void BookmarkCurrentPage(Browser
* browser
);
96 void BookmarkCurrentPageFromStar(Browser
* browser
);
97 bool CanBookmarkCurrentPage(const Browser
* browser
);
98 void BookmarkAllTabs(Browser
* browser
);
99 bool CanBookmarkAllTabs(const Browser
* browser
);
100 void TogglePagePinnedToStartScreen(Browser
* browser
);
101 void SavePage(Browser
* browser
);
102 bool CanSavePage(const Browser
* browser
);
103 void ShowFindBar(Browser
* browser
);
104 void ShowWebsiteSettings(Browser
* browser
,
105 content::WebContents
* web_contents
,
107 const content::SSLStatus
& ssl
);
108 void Print(Browser
* browser
);
109 bool CanPrint(const Browser
* browser
);
110 void AdvancedPrint(Browser
* browser
);
111 bool CanAdvancedPrint(const Browser
* browser
);
112 void PrintToDestination(Browser
* browser
);
113 void EmailPageLocation(Browser
* browser
);
114 bool CanEmailPageLocation(const Browser
* browser
);
115 void Cut(Browser
* browser
);
116 void Copy(Browser
* browser
);
117 void Paste(Browser
* browser
);
118 void Find(Browser
* browser
);
119 void FindNext(Browser
* browser
);
120 void FindPrevious(Browser
* browser
);
121 void FindInPage(Browser
* browser
, bool find_next
, bool forward_direction
);
122 void Zoom(Browser
* browser
, content::PageZoom zoom
);
123 void FocusToolbar(Browser
* browser
);
124 void FocusLocationBar(Browser
* browser
);
125 void FocusSearch(Browser
* browser
);
126 void FocusAppMenu(Browser
* browser
);
127 void FocusBookmarksToolbar(Browser
* browser
);
128 void FocusInfobars(Browser
* browser
);
129 void FocusNextPane(Browser
* browser
);
130 void FocusPreviousPane(Browser
* browser
);
131 void ToggleDevToolsWindow(Browser
* browser
, DevToolsToggleAction action
);
132 bool CanOpenTaskManager();
133 void OpenTaskManager(Browser
* browser
);
134 void OpenFeedbackDialog(Browser
* browser
);
135 void ToggleBookmarkBar(Browser
* browser
);
136 void ShowAppMenu(Browser
* browser
);
137 void ShowAvatarMenu(Browser
* browser
);
138 void OpenUpdateChromeDialog(Browser
* browser
);
139 void ToggleSpeechInput(Browser
* browser
);
140 bool CanRequestTabletSite(content::WebContents
* current_tab
);
141 bool IsRequestingTabletSite(Browser
* browser
);
142 void ToggleRequestTabletSite(Browser
* browser
);
143 void ToggleFullscreenMode(Browser
* browser
);
144 void ClearCache(Browser
* browser
);
145 bool IsDebuggerAttachedToCurrentTab(Browser
* browser
);
147 // Opens a view-source tab for a given web contents.
148 void ViewSource(Browser
* browser
, content::WebContents
* tab
);
150 // Opens a view-source tab for any frame within a given web contents.
151 void ViewSource(Browser
* browser
,
152 content::WebContents
* tab
,
154 const content::PageState
& page_state
);
156 void ViewSelectedSource(Browser
* browser
);
157 bool CanViewSource(const Browser
* browser
);
159 void CreateApplicationShortcuts(Browser
* browser
);
160 bool CanCreateApplicationShortcuts(const Browser
* browser
);
162 void ConvertTabToAppWindow(Browser
* browser
, content::WebContents
* contents
);
164 } // namespace chrome
166 #endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_