blob: c802726925da509eb73e94e7d72ab24cb733335e [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>
David Jacobo5fe17122017-10-14 00:13:359#include <vector>
[email protected]2cd4fde2012-06-26 03:10:2610
avi655876a2015-12-25 07:18:1511#include "build/build_config.h"
[email protected]70019152012-12-19 11:44:1912#include "chrome/browser/devtools/devtools_toggle_action.h"
afakhryf4575bd2017-04-28 02:21:0413#include "chrome/browser/ui/chrome_pages.h"
[email protected]2bf6314b2013-02-20 03:51:1414#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
[email protected]a37d4b02012-06-25 21:56:1015#include "content/public/common/page_zoom.h"
Scott Violet318a55f2018-03-30 19:08:1916#include "printing/buildflags/buildflags.h"
[email protected]f47621b2013-01-22 20:50:3317#include "ui/base/window_open_disposition.h"
[email protected]a37d4b02012-06-25 21:56:1018
[email protected]a37d4b02012-06-25 21:56:1019class Browser;
[email protected]5d98294912012-06-27 22:57:4020class CommandObserver;
[email protected]a37d4b02012-06-25 21:56:1021class GURL;
22class Profile;
23
24namespace content {
[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);
toyoshim7dad4b1182016-04-01 14:28:0567void ReloadBypassingCache(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);
Tommy Steimelc4477982017-11-29 18:07:1893void MuteSite(Browser* browser);
ellyjones0101ba02017-05-19 15:50:2694void PinTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1095void ConvertPopupToTabbedBrowser(Browser* browser);
96void Exit();
deepak.m154a7f392014-12-15 04:41:4397void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser);
98void BookmarkCurrentPageAllowingExtensionOverrides(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4099bool CanBookmarkCurrentPage(const Browser* browser);
100void BookmarkAllTabs(Browser* browser);
101bool CanBookmarkAllTabs(const Browser* browser);
bondd052b5f82015-10-28 22:39:32102void SaveCreditCard(Browser* browser);
[email protected]e625b7602013-10-28 09:24:56103void Translate(Browser* browser);
[email protected]4bee4432014-05-05 13:11:41104void ManagePasswordsForPage(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10105void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40106bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10107void ShowFindBar(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10108void Print(Browser* browser);
[email protected]010152f2014-07-15 00:16:47109bool CanPrint(Browser* browser);
Lei Zhang48a4a5262018-04-17 20:18:44110#if BUILDFLAG(ENABLE_PRINTING)
vitalybukaf9433e42014-09-08 10:04:55111void BasicPrint(Browser* browser);
112bool CanBasicPrint(Browser* browser);
Lei Zhang48a4a5262018-04-17 20:18:44113#endif // ENABLE_PRINTING
apacible45cbfc92015-09-28 22:45:41114bool CanRouteMedia(Browser* browser);
115void RouteMedia(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10116void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40117bool CanEmailPageLocation(const Browser* browser);
pkastingcd3f08bce2015-04-18 13:37:12118void CutCopyPaste(Browser* browser, int command_id);
[email protected]a37d4b02012-06-25 21:56:10119void Find(Browser* browser);
120void FindNext(Browser* browser);
121void FindPrevious(Browser* browser);
122void FindInPage(Browser* browser, bool find_next, bool forward_direction);
123void Zoom(Browser* browser, content::PageZoom zoom);
124void FocusToolbar(Browser* browser);
125void FocusLocationBar(Browser* browser);
126void FocusSearch(Browser* browser);
127void FocusAppMenu(Browser* browser);
128void FocusBookmarksToolbar(Browser* browser);
David Tsengc0b1b642018-01-24 07:12:27129void FocusInactivePopupForAccessibility(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10130void FocusNextPane(Browser* browser);
131void FocusPreviousPane(Browser* browser);
132void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
133bool CanOpenTaskManager();
[email protected]29c262de2013-06-22 15:39:38134void OpenTaskManager(Browser* browser);
afakhryf4575bd2017-04-28 02:21:04135void OpenFeedbackDialog(Browser* browser, FeedbackSource source);
[email protected]a37d4b02012-06-25 21:56:10136void ToggleBookmarkBar(Browser* browser);
137void ShowAppMenu(Browser* browser);
138void ShowAvatarMenu(Browser* browser);
139void OpenUpdateChromeDialog(Browser* browser);
[email protected]6bd370b2014-05-28 14:19:47140void DistillCurrentPage(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36141bool CanRequestTabletSite(content::WebContents* current_tab);
142bool IsRequestingTabletSite(Browser* browser);
143void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28144void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39145void ClearCache(Browser* browser);
146bool IsDebuggerAttachedToCurrentTab(Browser* browser);
Christopher Lam0dbac2b2017-11-14 07:12:10147void CopyURL(Browser* browser);
148void OpenInChrome(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40149bool CanViewSource(const Browser* browser);
Tom Andersonbddfeda52018-06-14 22:25:06150#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
151void ToggleConfirmToQuitOption(Browser* browser);
152#endif
[email protected]5d98294912012-06-27 22:57:40153
[email protected]92086542014-04-08 08:45:29154void CreateBookmarkAppFromCurrentWebContents(Browser* browser);
[email protected]92086542014-04-08 08:45:29155bool CanCreateBookmarkApp(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26156
[email protected]a37d4b02012-06-25 21:56:10157} // namespace chrome
158
159#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_