blob: d9933490ee2cae1a2fb3ce30993df76191dcaf33 [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"
Brett Wilson65f951c2016-11-03 22:06:1216#include "printing/features/features.h"
[email protected]f47621b2013-01-22 20:50:3317#include "ui/base/window_open_disposition.h"
[email protected]a37d4b02012-06-25 21:56:1018
David Jacobo5fe17122017-10-14 00:13:3519#if defined(OS_CHROMEOS)
20#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
21#include "chrome/browser/ui/browser_dialogs.h"
22#endif
23
[email protected]a37d4b02012-06-25 21:56:1024class Browser;
[email protected]5d98294912012-06-27 22:57:4025class CommandObserver;
[email protected]a37d4b02012-06-25 21:56:1026class GURL;
27class Profile;
28
29namespace content {
[email protected]a37d4b02012-06-25 21:56:1030class WebContents;
[email protected]a37d4b02012-06-25 21:56:1031}
32
33namespace chrome {
34
[email protected]5d98294912012-06-27 22:57:4035// For all commands, where a tab is not specified, the active tab is assumed.
36
37bool IsCommandEnabled(Browser* browser, int command);
38bool SupportsCommand(Browser* browser, int command);
39bool ExecuteCommand(Browser* browser, int command);
40bool ExecuteCommandWithDisposition(Browser* browser,
41 int command,
42 WindowOpenDisposition disposition);
43void UpdateCommandEnabled(Browser* browser, int command, bool enabled);
44void AddCommandObserver(Browser*, int command, CommandObserver* observer);
45void RemoveCommandObserver(Browser*, int command, CommandObserver* observer);
46
47int GetContentRestrictions(const Browser* browser);
48
[email protected]a37d4b02012-06-25 21:56:1049// Opens a new window with the default blank tab.
scottmg851949002016-02-09 20:09:4450void NewEmptyWindow(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1051
52// Opens a new window with the default blank tab. This bypasses metrics and
53// various internal bookkeeping; NewEmptyWindow (above) is preferred.
scottmg851949002016-02-09 20:09:4454Browser* OpenEmptyWindow(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1055
56// Opens a new window with the tabs from |profile|'s TabRestoreService.
scottmgd161e6c2016-02-17 02:08:0157void OpenWindowWithRestoredTabs(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1058
scottmg851949002016-02-09 20:09:4459// Opens the specified URL in a new browser window in an incognito session. If
60// there is already an existing active incognito session for the specified
61// |profile|, that session is re- used.
62void OpenURLOffTheRecord(Profile* profile, const GURL& url);
[email protected]a37d4b02012-06-25 21:56:1063
[email protected]5d98294912012-06-27 22:57:4064bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1065void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4066bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1067void GoForward(Browser* browser, WindowOpenDisposition disposition);
68bool NavigateToIndexWithDisposition(Browser* browser,
69 int index,
[email protected]26b3abb12014-03-20 21:00:3970 WindowOpenDisposition disposition);
[email protected]a37d4b02012-06-25 21:56:1071void Reload(Browser* browser, WindowOpenDisposition disposition);
toyoshim7dad4b1182016-04-01 14:28:0572void ReloadBypassingCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4073bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1074void Home(Browser* browser, WindowOpenDisposition disposition);
75void OpenCurrentURL(Browser* browser);
76void Stop(Browser* browser);
77void NewWindow(Browser* browser);
78void NewIncognitoWindow(Browser* browser);
79void CloseWindow(Browser* browser);
80void NewTab(Browser* browser);
81void CloseTab(Browser* browser);
[email protected]d93dbd12014-08-04 23:42:5382bool CanZoomIn(content::WebContents* contents);
83bool CanZoomOut(content::WebContents* contents);
ccameronb7c1d6c2015-03-09 17:08:2484bool CanResetZoom(content::WebContents* contents);
[email protected]5d98294912012-06-27 22:57:4085void RestoreTab(Browser* browser);
[email protected]2bf6314b2013-02-20 03:51:1486TabStripModelDelegate::RestoreTabType GetRestoreTabType(
87 const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1088void SelectNextTab(Browser* browser);
89void SelectPreviousTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1090void MoveTabNext(Browser* browser);
91void MoveTabPrevious(Browser* browser);
92void SelectNumberedTab(Browser* browser, int index);
93void SelectLastTab(Browser* browser);
94void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4095bool CanDuplicateTab(const Browser* browser);
[email protected]ab93b6372012-11-28 05:20:2296content::WebContents* DuplicateTabAt(Browser* browser, int index);
estark9ecf2ed2015-06-03 15:25:4497bool CanDuplicateTabAt(const Browser* browser, int index);
ellyjones0101ba02017-05-19 15:50:2698void MuteTab(Browser* browser);
99void PinTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10100void ConvertPopupToTabbedBrowser(Browser* browser);
101void Exit();
deepak.m154a7f392014-12-15 04:41:43102void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser);
103void BookmarkCurrentPageAllowingExtensionOverrides(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40104bool CanBookmarkCurrentPage(const Browser* browser);
105void BookmarkAllTabs(Browser* browser);
106bool CanBookmarkAllTabs(const Browser* browser);
bondd052b5f82015-10-28 22:39:32107void SaveCreditCard(Browser* browser);
[email protected]e625b7602013-10-28 09:24:56108void Translate(Browser* browser);
[email protected]4bee4432014-05-05 13:11:41109void ManagePasswordsForPage(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10110void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40111bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10112void ShowFindBar(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10113void Print(Browser* browser);
[email protected]010152f2014-07-15 00:16:47114bool CanPrint(Browser* browser);
Brett Wilson65f951c2016-11-03 22:06:12115#if BUILDFLAG(ENABLE_BASIC_PRINTING)
vitalybukaf9433e42014-09-08 10:04:55116void BasicPrint(Browser* browser);
117bool CanBasicPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12118#endif // ENABLE_BASIC_PRINTING
apacible45cbfc92015-09-28 22:45:41119bool CanRouteMedia(Browser* browser);
120void RouteMedia(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10121void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40122bool CanEmailPageLocation(const Browser* browser);
pkastingcd3f08bce2015-04-18 13:37:12123void CutCopyPaste(Browser* browser, int command_id);
[email protected]a37d4b02012-06-25 21:56:10124void Find(Browser* browser);
125void FindNext(Browser* browser);
126void FindPrevious(Browser* browser);
127void FindInPage(Browser* browser, bool find_next, bool forward_direction);
128void Zoom(Browser* browser, content::PageZoom zoom);
129void FocusToolbar(Browser* browser);
130void FocusLocationBar(Browser* browser);
131void FocusSearch(Browser* browser);
132void FocusAppMenu(Browser* browser);
133void FocusBookmarksToolbar(Browser* browser);
[email protected]822ca8c62013-04-19 00:49:15134void FocusInfobars(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10135void FocusNextPane(Browser* browser);
136void FocusPreviousPane(Browser* browser);
137void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
138bool CanOpenTaskManager();
[email protected]29c262de2013-06-22 15:39:38139void OpenTaskManager(Browser* browser);
afakhryf4575bd2017-04-28 02:21:04140void OpenFeedbackDialog(Browser* browser, FeedbackSource source);
[email protected]a37d4b02012-06-25 21:56:10141void ToggleBookmarkBar(Browser* browser);
142void ShowAppMenu(Browser* browser);
143void ShowAvatarMenu(Browser* browser);
144void OpenUpdateChromeDialog(Browser* browser);
[email protected]6bd370b2014-05-28 14:19:47145void DistillCurrentPage(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36146bool CanRequestTabletSite(content::WebContents* current_tab);
147bool IsRequestingTabletSite(Browser* browser);
148void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28149void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39150void ClearCache(Browser* browser);
151bool IsDebuggerAttachedToCurrentTab(Browser* browser);
Christopher Lam0dbac2b2017-11-14 07:12:10152void CopyURL(Browser* browser);
153void OpenInChrome(Browser* browser);
David Jacobo5fe17122017-10-14 00:13:35154#if defined(OS_CHROMEOS)
155void QueryAndDisplayArcApps(
156 const Browser* browser,
157 const std::vector<arc::ArcNavigationThrottle::AppInfo>& app_info,
158 IntentPickerResponse callback);
159void SetIntentPickerViewVisibility(Browser* browser, bool visible);
160#endif // defined(OS_CHROMEOS)
[email protected]a37d4b02012-06-25 21:56:10161
[email protected]5d98294912012-06-27 22:57:40162bool CanViewSource(const Browser* browser);
163
[email protected]92086542014-04-08 08:45:29164void CreateBookmarkAppFromCurrentWebContents(Browser* browser);
[email protected]92086542014-04-08 08:45:29165bool CanCreateBookmarkApp(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26166
[email protected]a37d4b02012-06-25 21:56:10167} // namespace chrome
168
169#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_