blob: 9379fba2c73410fcc2ee2b598585d77d24c7b2e5 [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
avi655876a2015-12-25 07:18:1510#include "build/build_config.h"
[email protected]70019152012-12-19 11:44:1911#include "chrome/browser/devtools/devtools_toggle_action.h"
[email protected]3b14b7f22012-10-04 01:29:0912#include "chrome/browser/ui/host_desktop.h"
[email protected]2bf6314b2013-02-20 03:51:1413#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
estarkd9e54fb2016-01-11 19:37:1214#include "components/security_state/security_state_model.h"
[email protected]a37d4b02012-06-25 21:56:1015#include "content/public/common/page_zoom.h"
[email protected]f47621b2013-01-22 20:50:3316#include "ui/base/window_open_disposition.h"
[email protected]a37d4b02012-06-25 21:56:1017
18class Browser;
[email protected]5d98294912012-06-27 22:57:4019class CommandObserver;
[email protected]a37d4b02012-06-25 21:56:1020class GURL;
21class Profile;
22
23namespace content {
[email protected]691aa2f2013-05-28 22:52:0424class PageState;
[email protected]a37d4b02012-06-25 21:56:1025class WebContents;
[email protected]a37d4b02012-06-25 21:56:1026}
27
28namespace chrome {
29
[email protected]5d98294912012-06-27 22:57:4030// For all commands, where a tab is not specified, the active tab is assumed.
31
32bool IsCommandEnabled(Browser* browser, int command);
33bool SupportsCommand(Browser* browser, int command);
34bool ExecuteCommand(Browser* browser, int command);
35bool ExecuteCommandWithDisposition(Browser* browser,
36 int command,
37 WindowOpenDisposition disposition);
38void UpdateCommandEnabled(Browser* browser, int command, bool enabled);
39void AddCommandObserver(Browser*, int command, CommandObserver* observer);
40void RemoveCommandObserver(Browser*, int command, CommandObserver* observer);
41
42int GetContentRestrictions(const Browser* browser);
43
[email protected]a37d4b02012-06-25 21:56:1044// Opens a new window with the default blank tab.
scottmg851949002016-02-09 20:09:4445void NewEmptyWindow(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1046
47// Opens a new window with the default blank tab. This bypasses metrics and
48// various internal bookkeeping; NewEmptyWindow (above) is preferred.
scottmg851949002016-02-09 20:09:4449Browser* OpenEmptyWindow(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1050
51// Opens a new window with the tabs from |profile|'s TabRestoreService.
scottmgd161e6c2016-02-17 02:08:0152void OpenWindowWithRestoredTabs(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1053
scottmg851949002016-02-09 20:09:4454// Opens the specified URL in a new browser window in an incognito session. If
55// there is already an existing active incognito session for the specified
56// |profile|, that session is re- used.
57void OpenURLOffTheRecord(Profile* profile, const GURL& url);
[email protected]a37d4b02012-06-25 21:56:1058
[email protected]5d98294912012-06-27 22:57:4059bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1060void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4061bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1062void GoForward(Browser* browser, WindowOpenDisposition disposition);
63bool NavigateToIndexWithDisposition(Browser* browser,
64 int index,
[email protected]26b3abb12014-03-20 21:00:3965 WindowOpenDisposition disposition);
[email protected]a37d4b02012-06-25 21:56:1066void Reload(Browser* browser, WindowOpenDisposition disposition);
67void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4068bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1069void Home(Browser* browser, WindowOpenDisposition disposition);
70void OpenCurrentURL(Browser* browser);
71void Stop(Browser* browser);
72void NewWindow(Browser* browser);
73void NewIncognitoWindow(Browser* browser);
74void CloseWindow(Browser* browser);
75void NewTab(Browser* browser);
76void CloseTab(Browser* browser);
[email protected]d93dbd12014-08-04 23:42:5377bool CanZoomIn(content::WebContents* contents);
78bool CanZoomOut(content::WebContents* contents);
ccameronb7c1d6c2015-03-09 17:08:2479bool CanResetZoom(content::WebContents* contents);
[email protected]5d98294912012-06-27 22:57:4080void RestoreTab(Browser* browser);
[email protected]2bf6314b2013-02-20 03:51:1481TabStripModelDelegate::RestoreTabType GetRestoreTabType(
82 const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1083void SelectNextTab(Browser* browser);
84void SelectPreviousTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1085void MoveTabNext(Browser* browser);
86void MoveTabPrevious(Browser* browser);
87void SelectNumberedTab(Browser* browser, int index);
88void SelectLastTab(Browser* browser);
89void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4090bool CanDuplicateTab(const Browser* browser);
[email protected]ab93b6372012-11-28 05:20:2291content::WebContents* DuplicateTabAt(Browser* browser, int index);
estark9ecf2ed2015-06-03 15:25:4492bool CanDuplicateTabAt(const Browser* browser, int index);
[email protected]a37d4b02012-06-25 21:56:1093void ConvertPopupToTabbedBrowser(Browser* browser);
94void Exit();
deepak.m154a7f392014-12-15 04:41:4395void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser);
96void BookmarkCurrentPageAllowingExtensionOverrides(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4097bool CanBookmarkCurrentPage(const Browser* browser);
98void BookmarkAllTabs(Browser* browser);
99bool CanBookmarkAllTabs(const Browser* browser);
bondd052b5f82015-10-28 22:39:32100void SaveCreditCard(Browser* browser);
[email protected]e625b7602013-10-28 09:24:56101void Translate(Browser* browser);
[email protected]4bee4432014-05-05 13:11:41102void ManagePasswordsForPage(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10103void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40104bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10105void ShowFindBar(Browser* browser);
estarkd9e54fb2016-01-11 19:37:12106void ShowWebsiteSettings(
107 Browser* browser,
108 content::WebContents* web_contents,
109 const GURL& url,
110 const security_state::SecurityStateModel::SecurityInfo& security_info);
[email protected]a37d4b02012-06-25 21:56:10111void Print(Browser* browser);
[email protected]010152f2014-07-15 00:16:47112bool CanPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12113#if defined(ENABLE_BASIC_PRINTING)
vitalybukaf9433e42014-09-08 10:04:55114void BasicPrint(Browser* browser);
115bool CanBasicPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12116#endif // ENABLE_BASIC_PRINTING
apacible45cbfc92015-09-28 22:45:41117bool CanRouteMedia(Browser* browser);
118void RouteMedia(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10119void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40120bool CanEmailPageLocation(const Browser* browser);
pkastingcd3f08bce2015-04-18 13:37:12121void CutCopyPaste(Browser* browser, int command_id);
[email protected]a37d4b02012-06-25 21:56:10122void Find(Browser* browser);
123void FindNext(Browser* browser);
124void FindPrevious(Browser* browser);
125void FindInPage(Browser* browser, bool find_next, bool forward_direction);
126void Zoom(Browser* browser, content::PageZoom zoom);
127void FocusToolbar(Browser* browser);
128void FocusLocationBar(Browser* browser);
129void FocusSearch(Browser* browser);
130void FocusAppMenu(Browser* browser);
131void FocusBookmarksToolbar(Browser* browser);
[email protected]822ca8c62013-04-19 00:49:15132void FocusInfobars(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10133void FocusNextPane(Browser* browser);
134void FocusPreviousPane(Browser* browser);
135void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
136bool CanOpenTaskManager();
[email protected]29c262de2013-06-22 15:39:38137void OpenTaskManager(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10138void OpenFeedbackDialog(Browser* browser);
139void ToggleBookmarkBar(Browser* browser);
140void ShowAppMenu(Browser* browser);
141void ShowAvatarMenu(Browser* browser);
anthonyvd7dc985da2015-03-23 16:53:19142void ShowFastUserSwitcher(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10143void OpenUpdateChromeDialog(Browser* browser);
[email protected]6bd370b2014-05-28 14:19:47144void DistillCurrentPage(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36145bool CanRequestTabletSite(content::WebContents* current_tab);
146bool IsRequestingTabletSite(Browser* browser);
147void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28148void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39149void ClearCache(Browser* browser);
150bool IsDebuggerAttachedToCurrentTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10151
[email protected]ab93b6372012-11-28 05:20:22152// Opens a view-source tab for a given web contents.
153void ViewSource(Browser* browser, content::WebContents* tab);
[email protected]2cd4fde2012-06-26 03:10:26154
[email protected]ab93b6372012-11-28 05:20:22155// Opens a view-source tab for any frame within a given web contents.
[email protected]2cd4fde2012-06-26 03:10:26156void ViewSource(Browser* browser,
[email protected]ab93b6372012-11-28 05:20:22157 content::WebContents* tab,
[email protected]2cd4fde2012-06-26 03:10:26158 const GURL& url,
[email protected]691aa2f2013-05-28 22:52:04159 const content::PageState& page_state);
[email protected]2cd4fde2012-06-26 03:10:26160
161void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40162bool CanViewSource(const Browser* browser);
163
[email protected]619f86182012-07-03 21:30:18164void CreateApplicationShortcuts(Browser* browser);
[email protected]92086542014-04-08 08:45:29165void CreateBookmarkAppFromCurrentWebContents(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40166bool CanCreateApplicationShortcuts(const Browser* browser);
[email protected]92086542014-04-08 08:45:29167bool CanCreateBookmarkApp(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26168
[email protected]40df6f52012-06-28 17:08:52169void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
170
[email protected]a37d4b02012-06-25 21:56:10171} // namespace chrome
172
173#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_