blob: 104776e5f462598c6ad0262b4ec93a1912cfe04a [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]691aa2f2013-05-28 22:52:0430class PageState;
[email protected]a37d4b02012-06-25 21:56:1031class WebContents;
[email protected]a37d4b02012-06-25 21:56:1032}
33
34namespace chrome {
35
[email protected]5d98294912012-06-27 22:57:4036// For all commands, where a tab is not specified, the active tab is assumed.
37
38bool IsCommandEnabled(Browser* browser, int command);
39bool SupportsCommand(Browser* browser, int command);
40bool ExecuteCommand(Browser* browser, int command);
41bool ExecuteCommandWithDisposition(Browser* browser,
42 int command,
43 WindowOpenDisposition disposition);
44void UpdateCommandEnabled(Browser* browser, int command, bool enabled);
45void AddCommandObserver(Browser*, int command, CommandObserver* observer);
46void RemoveCommandObserver(Browser*, int command, CommandObserver* observer);
47
48int GetContentRestrictions(const Browser* browser);
49
[email protected]a37d4b02012-06-25 21:56:1050// Opens a new window with the default blank tab.
scottmg851949002016-02-09 20:09:4451void NewEmptyWindow(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1052
53// Opens a new window with the default blank tab. This bypasses metrics and
54// various internal bookkeeping; NewEmptyWindow (above) is preferred.
scottmg851949002016-02-09 20:09:4455Browser* OpenEmptyWindow(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1056
57// Opens a new window with the tabs from |profile|'s TabRestoreService.
scottmgd161e6c2016-02-17 02:08:0158void OpenWindowWithRestoredTabs(Profile* profile);
[email protected]a37d4b02012-06-25 21:56:1059
scottmg851949002016-02-09 20:09:4460// Opens the specified URL in a new browser window in an incognito session. If
61// there is already an existing active incognito session for the specified
62// |profile|, that session is re- used.
63void OpenURLOffTheRecord(Profile* profile, const GURL& url);
[email protected]a37d4b02012-06-25 21:56:1064
[email protected]5d98294912012-06-27 22:57:4065bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1066void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4067bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1068void GoForward(Browser* browser, WindowOpenDisposition disposition);
69bool NavigateToIndexWithDisposition(Browser* browser,
70 int index,
[email protected]26b3abb12014-03-20 21:00:3971 WindowOpenDisposition disposition);
[email protected]a37d4b02012-06-25 21:56:1072void Reload(Browser* browser, WindowOpenDisposition disposition);
toyoshim7dad4b1182016-04-01 14:28:0573void ReloadBypassingCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4074bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1075void Home(Browser* browser, WindowOpenDisposition disposition);
76void OpenCurrentURL(Browser* browser);
77void Stop(Browser* browser);
78void NewWindow(Browser* browser);
79void NewIncognitoWindow(Browser* browser);
80void CloseWindow(Browser* browser);
81void NewTab(Browser* browser);
82void CloseTab(Browser* browser);
[email protected]d93dbd12014-08-04 23:42:5383bool CanZoomIn(content::WebContents* contents);
84bool CanZoomOut(content::WebContents* contents);
ccameronb7c1d6c2015-03-09 17:08:2485bool CanResetZoom(content::WebContents* contents);
[email protected]5d98294912012-06-27 22:57:4086void RestoreTab(Browser* browser);
[email protected]2bf6314b2013-02-20 03:51:1487TabStripModelDelegate::RestoreTabType GetRestoreTabType(
88 const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1089void SelectNextTab(Browser* browser);
90void SelectPreviousTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1091void MoveTabNext(Browser* browser);
92void MoveTabPrevious(Browser* browser);
93void SelectNumberedTab(Browser* browser, int index);
94void SelectLastTab(Browser* browser);
95void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4096bool CanDuplicateTab(const Browser* browser);
[email protected]ab93b6372012-11-28 05:20:2297content::WebContents* DuplicateTabAt(Browser* browser, int index);
estark9ecf2ed2015-06-03 15:25:4498bool CanDuplicateTabAt(const Browser* browser, int index);
ellyjones0101ba02017-05-19 15:50:2699void MuteTab(Browser* browser);
100void PinTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10101void ConvertPopupToTabbedBrowser(Browser* browser);
102void Exit();
deepak.m154a7f392014-12-15 04:41:43103void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser);
104void BookmarkCurrentPageAllowingExtensionOverrides(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40105bool CanBookmarkCurrentPage(const Browser* browser);
106void BookmarkAllTabs(Browser* browser);
107bool CanBookmarkAllTabs(const Browser* browser);
bondd052b5f82015-10-28 22:39:32108void SaveCreditCard(Browser* browser);
[email protected]e625b7602013-10-28 09:24:56109void Translate(Browser* browser);
[email protected]4bee4432014-05-05 13:11:41110void ManagePasswordsForPage(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10111void SavePage(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40112bool CanSavePage(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10113void ShowFindBar(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10114void Print(Browser* browser);
[email protected]010152f2014-07-15 00:16:47115bool CanPrint(Browser* browser);
Brett Wilson65f951c2016-11-03 22:06:12116#if BUILDFLAG(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);
afakhryf4575bd2017-04-28 02:21:04141void OpenFeedbackDialog(Browser* browser, FeedbackSource source);
[email protected]a37d4b02012-06-25 21:56:10142void ToggleBookmarkBar(Browser* browser);
143void ShowAppMenu(Browser* browser);
144void ShowAvatarMenu(Browser* browser);
145void OpenUpdateChromeDialog(Browser* browser);
[email protected]6bd370b2014-05-28 14:19:47146void DistillCurrentPage(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36147bool CanRequestTabletSite(content::WebContents* current_tab);
148bool IsRequestingTabletSite(Browser* browser);
149void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28150void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39151void ClearCache(Browser* browser);
152bool IsDebuggerAttachedToCurrentTab(Browser* browser);
David Jacobo5fe17122017-10-14 00:13:35153#if defined(OS_CHROMEOS)
154void QueryAndDisplayArcApps(
155 const Browser* browser,
156 const std::vector<arc::ArcNavigationThrottle::AppInfo>& app_info,
157 IntentPickerResponse callback);
158void SetIntentPickerViewVisibility(Browser* browser, bool visible);
159#endif // defined(OS_CHROMEOS)
[email protected]a37d4b02012-06-25 21:56:10160
[email protected]ab93b6372012-11-28 05:20:22161// Opens a view-source tab for a given web contents.
162void ViewSource(Browser* browser, content::WebContents* tab);
[email protected]2cd4fde2012-06-26 03:10:26163
[email protected]ab93b6372012-11-28 05:20:22164// Opens a view-source tab for any frame within a given web contents.
[email protected]2cd4fde2012-06-26 03:10:26165void ViewSource(Browser* browser,
[email protected]ab93b6372012-11-28 05:20:22166 content::WebContents* tab,
[email protected]2cd4fde2012-06-26 03:10:26167 const GURL& url,
[email protected]691aa2f2013-05-28 22:52:04168 const content::PageState& page_state);
[email protected]2cd4fde2012-06-26 03:10:26169
170void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40171bool CanViewSource(const Browser* browser);
172
[email protected]92086542014-04-08 08:45:29173void CreateBookmarkAppFromCurrentWebContents(Browser* browser);
[email protected]92086542014-04-08 08:45:29174bool CanCreateBookmarkApp(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26175
[email protected]a37d4b02012-06-25 21:56:10176} // namespace chrome
177
178#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_