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/ssl/security_state_model.h"
12 #include "chrome/browser/ui/host_desktop.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
14 #include "content/public/common/page_zoom.h"
15 #include "ui/base/window_open_disposition.h"
18 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 disposition
);
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 bool CanZoomIn(content::WebContents
* contents
);
80 bool CanZoomOut(content::WebContents
* contents
);
81 bool CanResetZoom(content::WebContents
* contents
);
82 void RestoreTab(Browser
* browser
);
83 TabStripModelDelegate::RestoreTabType
GetRestoreTabType(
84 const Browser
* browser
);
85 void SelectNextTab(Browser
* browser
);
86 void SelectPreviousTab(Browser
* browser
);
87 void MoveTabNext(Browser
* browser
);
88 void MoveTabPrevious(Browser
* browser
);
89 void SelectNumberedTab(Browser
* browser
, int index
);
90 void SelectLastTab(Browser
* browser
);
91 void DuplicateTab(Browser
* browser
);
92 bool CanDuplicateTab(const Browser
* browser
);
93 content::WebContents
* DuplicateTabAt(Browser
* browser
, int index
);
94 bool CanDuplicateTabAt(const Browser
* browser
, int index
);
95 void ConvertPopupToTabbedBrowser(Browser
* browser
);
97 void BookmarkCurrentPageIgnoringExtensionOverrides(Browser
* browser
);
98 void BookmarkCurrentPageAllowingExtensionOverrides(Browser
* browser
);
99 bool CanBookmarkCurrentPage(const Browser
* browser
);
100 void BookmarkAllTabs(Browser
* browser
);
101 bool CanBookmarkAllTabs(const Browser
* browser
);
102 void Translate(Browser
* browser
);
103 void ManagePasswordsForPage(Browser
* browser
);
105 void TogglePagePinnedToStartScreen(Browser
* browser
);
107 void SavePage(Browser
* browser
);
108 bool CanSavePage(const Browser
* browser
);
109 void ShowFindBar(Browser
* browser
);
110 void ShowWebsiteSettings(Browser
* browser
,
111 content::WebContents
* web_contents
,
113 const SecurityStateModel::SecurityInfo
& security_info
);
114 void Print(Browser
* browser
);
115 bool CanPrint(Browser
* browser
);
116 #if defined(ENABLE_BASIC_PRINTING)
117 void BasicPrint(Browser
* browser
);
118 bool CanBasicPrint(Browser
* browser
);
119 #endif // ENABLE_BASIC_PRINTING
120 void EmailPageLocation(Browser
* browser
);
121 bool CanEmailPageLocation(const Browser
* browser
);
122 void CutCopyPaste(Browser
* browser
, int command_id
);
123 void Find(Browser
* browser
);
124 void FindNext(Browser
* browser
);
125 void FindPrevious(Browser
* browser
);
126 void FindInPage(Browser
* browser
, bool find_next
, bool forward_direction
);
127 void Zoom(Browser
* browser
, content::PageZoom zoom
);
128 void FocusToolbar(Browser
* browser
);
129 void FocusLocationBar(Browser
* browser
);
130 void FocusSearch(Browser
* browser
);
131 void FocusAppMenu(Browser
* browser
);
132 void FocusBookmarksToolbar(Browser
* browser
);
133 void FocusInfobars(Browser
* browser
);
134 void FocusNextPane(Browser
* browser
);
135 void FocusPreviousPane(Browser
* browser
);
136 void ToggleDevToolsWindow(Browser
* browser
, DevToolsToggleAction action
);
137 bool CanOpenTaskManager();
138 void OpenTaskManager(Browser
* browser
);
139 void OpenFeedbackDialog(Browser
* browser
);
140 void ToggleBookmarkBar(Browser
* browser
);
141 void ShowAppMenu(Browser
* browser
);
142 void ShowAvatarMenu(Browser
* browser
);
143 void ShowFastUserSwitcher(Browser
* browser
);
144 void OpenUpdateChromeDialog(Browser
* browser
);
145 void ToggleSpeechInput(Browser
* browser
);
146 void DistillCurrentPage(Browser
* browser
);
147 bool CanRequestTabletSite(content::WebContents
* current_tab
);
148 bool IsRequestingTabletSite(Browser
* browser
);
149 void ToggleRequestTabletSite(Browser
* browser
);
150 void ToggleFullscreenMode(Browser
* browser
);
151 void ClearCache(Browser
* browser
);
152 bool IsDebuggerAttachedToCurrentTab(Browser
* browser
);
154 // Opens a view-source tab for a given web contents.
155 void ViewSource(Browser
* browser
, content::WebContents
* tab
);
157 // Opens a view-source tab for any frame within a given web contents.
158 void ViewSource(Browser
* browser
,
159 content::WebContents
* tab
,
161 const content::PageState
& page_state
);
163 void ViewSelectedSource(Browser
* browser
);
164 bool CanViewSource(const Browser
* browser
);
166 void CreateApplicationShortcuts(Browser
* browser
);
167 void CreateBookmarkAppFromCurrentWebContents(Browser
* browser
);
168 bool CanCreateApplicationShortcuts(const Browser
* browser
);
169 bool CanCreateBookmarkApp(const Browser
* browser
);
171 void ConvertTabToAppWindow(Browser
* browser
, content::WebContents
* contents
);
173 } // namespace chrome
175 #endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_