blob: e66808474528e2b30cdcb61a8e924367c9ebec3d [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.
[email protected]5fdb45b2012-10-23 20:26:2845void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type);
[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.
[email protected]5fdb45b2012-10-23 20:26:2849Browser* OpenEmptyWindow(Profile* profile, HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1050
51// Opens a new window with the tabs from |profile|'s TabRestoreService.
[email protected]3b265312013-01-17 02:49:5552void OpenWindowWithRestoredTabs(Profile* profile,
53 HostDesktopType host_desktop_type);
[email protected]a37d4b02012-06-25 21:56:1054
[email protected]3b14b7f22012-10-04 01:29:0955// Opens the specified URL in a new browser window in an incognito session on
56// the desktop specified by |desktop_type|. If there is already an existing
57// active incognito session for the specified |profile|, that session is re-
58// used.
59void OpenURLOffTheRecord(Profile* profile, const GURL& url,
60 chrome::HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1061
[email protected]5d98294912012-06-27 22:57:4062bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1063void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4064bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1065void GoForward(Browser* browser, WindowOpenDisposition disposition);
66bool NavigateToIndexWithDisposition(Browser* browser,
67 int index,
[email protected]26b3abb12014-03-20 21:00:3968 WindowOpenDisposition disposition);
[email protected]a37d4b02012-06-25 21:56:1069void Reload(Browser* browser, WindowOpenDisposition disposition);
70void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4071bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1072void Home(Browser* browser, WindowOpenDisposition disposition);
73void OpenCurrentURL(Browser* browser);
74void Stop(Browser* browser);
75void NewWindow(Browser* browser);
76void NewIncognitoWindow(Browser* browser);
77void CloseWindow(Browser* browser);
78void NewTab(Browser* browser);
79void CloseTab(Browser* browser);
[email protected]d93dbd12014-08-04 23:42:5380bool CanZoomIn(content::WebContents* contents);
81bool CanZoomOut(content::WebContents* contents);
ccameronb7c1d6c2015-03-09 17:08:2482bool CanResetZoom(content::WebContents* contents);
[email protected]5d98294912012-06-27 22:57:4083void RestoreTab(Browser* browser);
[email protected]2bf6314b2013-02-20 03:51:1484TabStripModelDelegate::RestoreTabType GetRestoreTabType(
85 const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1086void SelectNextTab(Browser* browser);
87void SelectPreviousTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1088void MoveTabNext(Browser* browser);
89void MoveTabPrevious(Browser* browser);
90void SelectNumberedTab(Browser* browser, int index);
91void SelectLastTab(Browser* browser);
92void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4093bool CanDuplicateTab(const Browser* browser);
[email protected]ab93b6372012-11-28 05:20:2294content::WebContents* DuplicateTabAt(Browser* browser, int index);
estark9ecf2ed2015-06-03 15:25:4495bool CanDuplicateTabAt(const Browser* browser, int index);
[email protected]a37d4b02012-06-25 21:56:1096void ConvertPopupToTabbedBrowser(Browser* browser);
97void Exit();
deepak.m154a7f392014-12-15 04:41:4398void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser);
99void BookmarkCurrentPageAllowingExtensionOverrides(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40100bool CanBookmarkCurrentPage(const Browser* browser);
101void BookmarkAllTabs(Browser* browser);
102bool CanBookmarkAllTabs(const Browser* browser);
bondd052b5f82015-10-28 22:39:32103void SaveCreditCard(Browser* browser);
[email protected]e625b7602013-10-28 09:24:56104void Translate(Browser* browser);
[email protected]4bee4432014-05-05 13:11:41105void ManagePasswordsForPage(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10106void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40107bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10108void ShowFindBar(Browser* browser);
estarkd9e54fb2016-01-11 19:37:12109void ShowWebsiteSettings(
110 Browser* browser,
111 content::WebContents* web_contents,
112 const GURL& url,
113 const security_state::SecurityStateModel::SecurityInfo& security_info);
[email protected]a37d4b02012-06-25 21:56:10114void Print(Browser* browser);
[email protected]010152f2014-07-15 00:16:47115bool CanPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12116#if defined(ENABLE_BASIC_PRINTING)
vitalybukaf9433e42014-09-08 10:04:55117void BasicPrint(Browser* browser);
118bool CanBasicPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12119#endif // ENABLE_BASIC_PRINTING
apacible45cbfc92015-09-28 22:45:41120bool CanRouteMedia(Browser* browser);
121void RouteMedia(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10122void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40123bool CanEmailPageLocation(const Browser* browser);
pkastingcd3f08bce2015-04-18 13:37:12124void CutCopyPaste(Browser* browser, int command_id);
[email protected]a37d4b02012-06-25 21:56:10125void Find(Browser* browser);
126void FindNext(Browser* browser);
127void FindPrevious(Browser* browser);
128void FindInPage(Browser* browser, bool find_next, bool forward_direction);
129void Zoom(Browser* browser, content::PageZoom zoom);
130void FocusToolbar(Browser* browser);
131void FocusLocationBar(Browser* browser);
132void FocusSearch(Browser* browser);
133void FocusAppMenu(Browser* browser);
134void FocusBookmarksToolbar(Browser* browser);
[email protected]822ca8c62013-04-19 00:49:15135void FocusInfobars(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10136void FocusNextPane(Browser* browser);
137void FocusPreviousPane(Browser* browser);
138void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
139bool CanOpenTaskManager();
[email protected]29c262de2013-06-22 15:39:38140void OpenTaskManager(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10141void OpenFeedbackDialog(Browser* browser);
142void ToggleBookmarkBar(Browser* browser);
143void ShowAppMenu(Browser* browser);
144void ShowAvatarMenu(Browser* browser);
anthonyvd7dc985da2015-03-23 16:53:19145void ShowFastUserSwitcher(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10146void OpenUpdateChromeDialog(Browser* browser);
[email protected]6bd370b2014-05-28 14:19:47147void DistillCurrentPage(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36148bool CanRequestTabletSite(content::WebContents* current_tab);
149bool IsRequestingTabletSite(Browser* browser);
150void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28151void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39152void ClearCache(Browser* browser);
153bool IsDebuggerAttachedToCurrentTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10154
[email protected]ab93b6372012-11-28 05:20:22155// Opens a view-source tab for a given web contents.
156void ViewSource(Browser* browser, content::WebContents* tab);
[email protected]2cd4fde2012-06-26 03:10:26157
[email protected]ab93b6372012-11-28 05:20:22158// Opens a view-source tab for any frame within a given web contents.
[email protected]2cd4fde2012-06-26 03:10:26159void ViewSource(Browser* browser,
[email protected]ab93b6372012-11-28 05:20:22160 content::WebContents* tab,
[email protected]2cd4fde2012-06-26 03:10:26161 const GURL& url,
[email protected]691aa2f2013-05-28 22:52:04162 const content::PageState& page_state);
[email protected]2cd4fde2012-06-26 03:10:26163
164void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40165bool CanViewSource(const Browser* browser);
166
[email protected]619f86182012-07-03 21:30:18167void CreateApplicationShortcuts(Browser* browser);
[email protected]92086542014-04-08 08:45:29168void CreateBookmarkAppFromCurrentWebContents(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40169bool CanCreateApplicationShortcuts(const Browser* browser);
[email protected]92086542014-04-08 08:45:29170bool CanCreateBookmarkApp(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26171
[email protected]40df6f52012-06-28 17:08:52172void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
173
[email protected]a37d4b02012-06-25 21:56:10174} // namespace chrome
175
176#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_