blob: 3b32291e89eec5bf6a1bc5ebd5759f3b3de362d2 [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
[email protected]70019152012-12-19 11:44:1910#include "chrome/browser/devtools/devtools_toggle_action.h"
estarka3121f6b2015-09-18 21:15:5911#include "chrome/browser/ssl/security_state_model.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"
[email protected]a37d4b02012-06-25 21:56:1014#include "content/public/common/page_zoom.h"
[email protected]f47621b2013-01-22 20:50:3315#include "ui/base/window_open_disposition.h"
[email protected]a37d4b02012-06-25 21:56:1016
17class Browser;
[email protected]5d98294912012-06-27 22:57:4018class CommandObserver;
[email protected]a37d4b02012-06-25 21:56:1019class GURL;
20class Profile;
21
22namespace content {
[email protected]691aa2f2013-05-28 22:52:0423class PageState;
[email protected]a37d4b02012-06-25 21:56:1024class WebContents;
[email protected]a37d4b02012-06-25 21:56:1025}
26
27namespace chrome {
28
[email protected]5d98294912012-06-27 22:57:4029// For all commands, where a tab is not specified, the active tab is assumed.
30
31bool IsCommandEnabled(Browser* browser, int command);
32bool SupportsCommand(Browser* browser, int command);
33bool ExecuteCommand(Browser* browser, int command);
34bool ExecuteCommandWithDisposition(Browser* browser,
35 int command,
36 WindowOpenDisposition disposition);
37void UpdateCommandEnabled(Browser* browser, int command, bool enabled);
38void AddCommandObserver(Browser*, int command, CommandObserver* observer);
39void RemoveCommandObserver(Browser*, int command, CommandObserver* observer);
40
41int GetContentRestrictions(const Browser* browser);
42
[email protected]a37d4b02012-06-25 21:56:1043// Opens a new window with the default blank tab.
[email protected]5fdb45b2012-10-23 20:26:2844void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1045
46// Opens a new window with the default blank tab. This bypasses metrics and
47// various internal bookkeeping; NewEmptyWindow (above) is preferred.
[email protected]5fdb45b2012-10-23 20:26:2848Browser* OpenEmptyWindow(Profile* profile, HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1049
50// Opens a new window with the tabs from |profile|'s TabRestoreService.
[email protected]3b265312013-01-17 02:49:5551void OpenWindowWithRestoredTabs(Profile* profile,
52 HostDesktopType host_desktop_type);
[email protected]a37d4b02012-06-25 21:56:1053
[email protected]3b14b7f22012-10-04 01:29:0954// Opens the specified URL in a new browser window in an incognito session on
55// the desktop specified by |desktop_type|. If there is already an existing
56// active incognito session for the specified |profile|, that session is re-
57// used.
58void OpenURLOffTheRecord(Profile* profile, const GURL& url,
59 chrome::HostDesktopType desktop_type);
[email protected]a37d4b02012-06-25 21:56:1060
[email protected]5d98294912012-06-27 22:57:4061bool CanGoBack(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1062void GoBack(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4063bool CanGoForward(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1064void GoForward(Browser* browser, WindowOpenDisposition disposition);
65bool NavigateToIndexWithDisposition(Browser* browser,
66 int index,
[email protected]26b3abb12014-03-20 21:00:3967 WindowOpenDisposition disposition);
[email protected]a37d4b02012-06-25 21:56:1068void Reload(Browser* browser, WindowOpenDisposition disposition);
69void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition);
[email protected]5d98294912012-06-27 22:57:4070bool CanReload(const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1071void Home(Browser* browser, WindowOpenDisposition disposition);
72void OpenCurrentURL(Browser* browser);
73void Stop(Browser* browser);
74void NewWindow(Browser* browser);
75void NewIncognitoWindow(Browser* browser);
76void CloseWindow(Browser* browser);
77void NewTab(Browser* browser);
78void CloseTab(Browser* browser);
[email protected]d93dbd12014-08-04 23:42:5379bool CanZoomIn(content::WebContents* contents);
80bool CanZoomOut(content::WebContents* contents);
ccameronb7c1d6c2015-03-09 17:08:2481bool CanResetZoom(content::WebContents* contents);
[email protected]5d98294912012-06-27 22:57:4082void RestoreTab(Browser* browser);
[email protected]2bf6314b2013-02-20 03:51:1483TabStripModelDelegate::RestoreTabType GetRestoreTabType(
84 const Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1085void SelectNextTab(Browser* browser);
86void SelectPreviousTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:1087void MoveTabNext(Browser* browser);
88void MoveTabPrevious(Browser* browser);
89void SelectNumberedTab(Browser* browser, int index);
90void SelectLastTab(Browser* browser);
91void DuplicateTab(Browser* browser);
[email protected]5d98294912012-06-27 22:57:4092bool CanDuplicateTab(const Browser* browser);
[email protected]ab93b6372012-11-28 05:20:2293content::WebContents* DuplicateTabAt(Browser* browser, int index);
estark9ecf2ed2015-06-03 15:25:4494bool CanDuplicateTabAt(const Browser* browser, int index);
[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:32102#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
103void SaveCreditCard(Browser* browser);
104#endif
[email protected]e625b7602013-10-28 09:24:56105void Translate(Browser* browser);
[email protected]4bee4432014-05-05 13:11:41106void ManagePasswordsForPage(Browser* browser);
thestig5149d272014-10-30 07:25:29107#if defined(OS_WIN)
[email protected]ffe6de62012-07-19 00:02:35108void TogglePagePinnedToStartScreen(Browser* browser);
thestig5149d272014-10-30 07:25:29109#endif
[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]2285262d2013-01-24 16:19:35113void ShowWebsiteSettings(Browser* browser,
114 content::WebContents* web_contents,
115 const GURL& url,
estarka3121f6b2015-09-18 21:15:59116 const SecurityStateModel::SecurityInfo& security_info);
[email protected]a37d4b02012-06-25 21:56:10117void Print(Browser* browser);
[email protected]010152f2014-07-15 00:16:47118bool CanPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12119#if defined(ENABLE_BASIC_PRINTING)
vitalybukaf9433e42014-09-08 10:04:55120void BasicPrint(Browser* browser);
121bool CanBasicPrint(Browser* browser);
vitalybukae29991c2014-11-05 21:15:12122#endif // ENABLE_BASIC_PRINTING
apacible45cbfc92015-09-28 22:45:41123bool CanRouteMedia(Browser* browser);
124void RouteMedia(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10125void EmailPageLocation(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40126bool CanEmailPageLocation(const Browser* browser);
pkastingcd3f08bce2015-04-18 13:37:12127void CutCopyPaste(Browser* browser, int command_id);
[email protected]a37d4b02012-06-25 21:56:10128void Find(Browser* browser);
129void FindNext(Browser* browser);
130void FindPrevious(Browser* browser);
131void FindInPage(Browser* browser, bool find_next, bool forward_direction);
132void Zoom(Browser* browser, content::PageZoom zoom);
133void FocusToolbar(Browser* browser);
134void FocusLocationBar(Browser* browser);
135void FocusSearch(Browser* browser);
136void FocusAppMenu(Browser* browser);
137void FocusBookmarksToolbar(Browser* browser);
[email protected]822ca8c62013-04-19 00:49:15138void FocusInfobars(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10139void FocusNextPane(Browser* browser);
140void FocusPreviousPane(Browser* browser);
141void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action);
142bool CanOpenTaskManager();
[email protected]29c262de2013-06-22 15:39:38143void OpenTaskManager(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10144void OpenFeedbackDialog(Browser* browser);
145void ToggleBookmarkBar(Browser* browser);
146void ShowAppMenu(Browser* browser);
147void ShowAvatarMenu(Browser* browser);
anthonyvd7dc985da2015-03-23 16:53:19148void ShowFastUserSwitcher(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10149void OpenUpdateChromeDialog(Browser* browser);
150void ToggleSpeechInput(Browser* browser);
[email protected]6bd370b2014-05-28 14:19:47151void DistillCurrentPage(Browser* browser);
[email protected]9b7ab882012-09-10 23:46:36152bool CanRequestTabletSite(content::WebContents* current_tab);
153bool IsRequestingTabletSite(Browser* browser);
154void ToggleRequestTabletSite(Browser* browser);
[email protected]3f32b9b2012-07-09 16:59:28155void ToggleFullscreenMode(Browser* browser);
[email protected]d3446bda2012-07-12 14:24:39156void ClearCache(Browser* browser);
157bool IsDebuggerAttachedToCurrentTab(Browser* browser);
[email protected]a37d4b02012-06-25 21:56:10158
[email protected]ab93b6372012-11-28 05:20:22159// Opens a view-source tab for a given web contents.
160void ViewSource(Browser* browser, content::WebContents* tab);
[email protected]2cd4fde2012-06-26 03:10:26161
[email protected]ab93b6372012-11-28 05:20:22162// Opens a view-source tab for any frame within a given web contents.
[email protected]2cd4fde2012-06-26 03:10:26163void ViewSource(Browser* browser,
[email protected]ab93b6372012-11-28 05:20:22164 content::WebContents* tab,
[email protected]2cd4fde2012-06-26 03:10:26165 const GURL& url,
[email protected]691aa2f2013-05-28 22:52:04166 const content::PageState& page_state);
[email protected]2cd4fde2012-06-26 03:10:26167
168void ViewSelectedSource(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40169bool CanViewSource(const Browser* browser);
170
[email protected]619f86182012-07-03 21:30:18171void CreateApplicationShortcuts(Browser* browser);
[email protected]92086542014-04-08 08:45:29172void CreateBookmarkAppFromCurrentWebContents(Browser* browser);
[email protected]5d98294912012-06-27 22:57:40173bool CanCreateApplicationShortcuts(const Browser* browser);
[email protected]92086542014-04-08 08:45:29174bool CanCreateBookmarkApp(const Browser* browser);
[email protected]2cd4fde2012-06-26 03:10:26175
[email protected]40df6f52012-06-28 17:08:52176void ConvertTabToAppWindow(Browser* browser, content::WebContents* contents);
177
[email protected]a37d4b02012-06-25 21:56:10178} // namespace chrome
179
180#endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_