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 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 ActualSize(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(Browser
* browser
, int index
);
95 void ConvertPopupToTabbedBrowser(Browser
* browser
);
97 void BookmarkCurrentPage(Browser
* browser
);
98 bool CanBookmarkCurrentPage(const Browser
* browser
);
99 void BookmarkAllTabs(Browser
* browser
);
100 bool CanBookmarkAllTabs(const Browser
* browser
);
101 void Translate(Browser
* browser
);
102 void ManagePasswordsForPage(Browser
* browser
);
104 void TogglePagePinnedToStartScreen(Browser
* browser
);
106 void SavePage(Browser
* browser
);
107 bool CanSavePage(const Browser
* browser
);
108 void ShowFindBar(Browser
* browser
);
109 void ShowWebsiteSettings(Browser
* browser
,
110 content::WebContents
* web_contents
,
112 const content::SSLStatus
& ssl
);
113 void Print(Browser
* browser
);
114 bool CanPrint(Browser
* browser
);
115 #if defined(ENABLE_BASIC_PRINTING)
116 void BasicPrint(Browser
* browser
);
117 bool CanBasicPrint(Browser
* browser
);
118 #endif // ENABLE_BASIC_PRINTING
119 void EmailPageLocation(Browser
* browser
);
120 bool CanEmailPageLocation(const Browser
* browser
);
121 void Cut(Browser
* browser
);
122 void Copy(Browser
* browser
);
123 void Paste(Browser
* browser
);
124 void Find(Browser
* browser
);
125 void FindNext(Browser
* browser
);
126 void FindPrevious(Browser
* browser
);
127 void FindInPage(Browser
* browser
, bool find_next
, bool forward_direction
);
128 void Zoom(Browser
* browser
, content::PageZoom zoom
);
129 void FocusToolbar(Browser
* browser
);
130 void FocusLocationBar(Browser
* browser
);
131 void FocusSearch(Browser
* browser
);
132 void FocusAppMenu(Browser
* browser
);
133 void FocusBookmarksToolbar(Browser
* browser
);
134 void FocusInfobars(Browser
* browser
);
135 void FocusNextPane(Browser
* browser
);
136 void FocusPreviousPane(Browser
* browser
);
137 void ToggleDevToolsWindow(Browser
* browser
, DevToolsToggleAction action
);
138 bool CanOpenTaskManager();
139 void OpenTaskManager(Browser
* browser
);
140 void OpenFeedbackDialog(Browser
* browser
);
141 void ToggleBookmarkBar(Browser
* browser
);
142 void ShowAppMenu(Browser
* browser
);
143 void ShowAvatarMenu(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_