Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / browser_commands.h
blobb4fa6fce2e717c13cf12ba98eb63435936854409
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_
8 #include <string>
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"
16 class Browser;
17 class CommandObserver;
18 class GURL;
19 class Profile;
21 namespace content {
22 class PageState;
23 class WebContents;
24 struct SSLStatus;
27 namespace chrome {
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,
35 int command,
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-
57 // used.
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,
66 int index,
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);
94 void Exit();
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 Translate(Browser* browser);
101 void TogglePagePinnedToStartScreen(Browser* browser);
102 void SavePage(Browser* browser);
103 bool CanSavePage(const Browser* browser);
104 void ShowFindBar(Browser* browser);
105 void ShowWebsiteSettings(Browser* browser,
106 content::WebContents* web_contents,
107 const GURL& url,
108 const content::SSLStatus& ssl);
109 void Print(Browser* browser);
110 bool CanPrint(const Browser* browser);
111 void AdvancedPrint(Browser* browser);
112 bool CanAdvancedPrint(const Browser* browser);
113 void PrintToDestination(Browser* browser);
114 void EmailPageLocation(Browser* browser);
115 bool CanEmailPageLocation(const Browser* browser);
116 void Cut(Browser* browser);
117 void Copy(Browser* browser);
118 void Paste(Browser* browser);
119 void Find(Browser* browser);
120 void FindNext(Browser* browser);
121 void FindPrevious(Browser* browser);
122 void FindInPage(Browser* browser, bool find_next, bool forward_direction);
123 void Zoom(Browser* browser, content::PageZoom zoom);
124 void FocusToolbar(Browser* browser);
125 void FocusLocationBar(Browser* browser);
126 void FocusSearch(Browser* browser);
127 void FocusAppMenu(Browser* browser);
128 void FocusBookmarksToolbar(Browser* browser);
129 void FocusInfobars(Browser* browser);
130 void FocusNextPane(Browser* browser);
131 void FocusPreviousPane(Browser* browser);
132 void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
133 bool CanOpenTaskManager();
134 void OpenTaskManager(Browser* browser);
135 void OpenFeedbackDialog(Browser* browser);
136 void ToggleBookmarkBar(Browser* browser);
137 void ShowAppMenu(Browser* browser);
138 void ShowAvatarMenu(Browser* browser);
139 void OpenUpdateChromeDialog(Browser* browser);
140 void ToggleSpeechInput(Browser* browser);
141 bool CanRequestTabletSite(content::WebContents* current_tab);
142 bool IsRequestingTabletSite(Browser* browser);
143 void ToggleRequestTabletSite(Browser* browser);
144 void ToggleFullscreenMode(Browser* browser);
145 void ClearCache(Browser* browser);
146 bool IsDebuggerAttachedToCurrentTab(Browser* browser);
148 // Opens a view-source tab for a given web contents.
149 void ViewSource(Browser* browser, content::WebContents* tab);
151 // Opens a view-source tab for any frame within a given web contents.
152 void ViewSource(Browser* browser,
153 content::WebContents* tab,
154 const GURL& url,
155 const content::PageState& page_state);
157 void ViewSelectedSource(Browser* browser);
158 bool CanViewSource(const Browser* browser);
160 void CreateApplicationShortcuts(Browser* browser);
161 void CreateHostedAppFromCurrentWebContents(Browser* browser);
162 bool CanCreateApplicationShortcuts(const Browser* browser);
164 void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
166 } // namespace chrome
168 #endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_