| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_BROWSER_COMMANDS_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_COMMANDS_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_COMMANDS_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_COMMANDS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/debugger/devtools_toggle_action.h" | 11 #include "chrome/browser/debugger/devtools_toggle_action.h" |
| 12 #include "content/public/common/page_zoom.h" | 12 #include "content/public/common/page_zoom.h" |
| 13 #include "webkit/glue/window_open_disposition.h" | 13 #include "webkit/glue/window_open_disposition.h" |
| 14 | 14 |
| 15 class Browser; | 15 class Browser; |
| 16 class CommandObserver; |
| 16 class GURL; | 17 class GURL; |
| 17 class Profile; | 18 class Profile; |
| 18 class TabContents; | 19 class TabContents; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class WebContents; | 22 class WebContents; |
| 22 struct SSLStatus; | 23 struct SSLStatus; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace chrome { | 26 namespace chrome { |
| 26 | 27 |
| 28 // For all commands, where a tab is not specified, the active tab is assumed. |
| 29 |
| 30 bool IsCommandEnabled(Browser* browser, int command); |
| 31 bool SupportsCommand(Browser* browser, int command); |
| 32 bool ExecuteCommand(Browser* browser, int command); |
| 33 bool ExecuteCommandWithDisposition(Browser* browser, |
| 34 int command, |
| 35 WindowOpenDisposition disposition); |
| 36 void UpdateCommandEnabled(Browser* browser, int command, bool enabled); |
| 37 void AddCommandObserver(Browser*, int command, CommandObserver* observer); |
| 38 void RemoveCommandObserver(Browser*, int command, CommandObserver* observer); |
| 39 |
| 40 int GetContentRestrictions(const Browser* browser); |
| 41 |
| 27 // Opens a new window with the default blank tab. | 42 // Opens a new window with the default blank tab. |
| 28 void NewEmptyWindow(Profile* profile); | 43 void NewEmptyWindow(Profile* profile); |
| 29 | 44 |
| 30 // Opens a new window with the default blank tab. This bypasses metrics and | 45 // Opens a new window with the default blank tab. This bypasses metrics and |
| 31 // various internal bookkeeping; NewEmptyWindow (above) is preferred. | 46 // various internal bookkeeping; NewEmptyWindow (above) is preferred. |
| 32 Browser* OpenEmptyWindow(Profile* profile); | 47 Browser* OpenEmptyWindow(Profile* profile); |
| 33 | 48 |
| 34 // Opens a new window with the tabs from |profile|'s TabRestoreService. | 49 // Opens a new window with the tabs from |profile|'s TabRestoreService. |
| 35 void OpenWindowWithRestoredTabs(Profile* profile); | 50 void OpenWindowWithRestoredTabs(Profile* profile); |
| 36 | 51 |
| 37 // Opens the specified URL in a new browser window in an incognito session. | 52 // Opens the specified URL in a new browser window in an incognito session. |
| 38 // If there is already an existing active incognito session for the specified | 53 // If there is already an existing active incognito session for the specified |
| 39 // |profile|, that session is re-used. | 54 // |profile|, that session is re-used. |
| 40 void OpenURLOffTheRecord(Profile* profile, const GURL& url); | 55 void OpenURLOffTheRecord(Profile* profile, const GURL& url); |
| 41 | 56 |
| 42 bool CanGoBack(Browser* browser); | 57 bool CanGoBack(const Browser* browser); |
| 43 void GoBack(Browser* browser, WindowOpenDisposition disposition); | 58 void GoBack(Browser* browser, WindowOpenDisposition disposition); |
| 44 bool CanGoForward(Browser* browser); | 59 bool CanGoForward(const Browser* browser); |
| 45 void GoForward(Browser* browser, WindowOpenDisposition disposition); | 60 void GoForward(Browser* browser, WindowOpenDisposition disposition); |
| 46 bool NavigateToIndexWithDisposition(Browser* browser, | 61 bool NavigateToIndexWithDisposition(Browser* browser, |
| 47 int index, | 62 int index, |
| 48 WindowOpenDisposition disp); | 63 WindowOpenDisposition disp); |
| 49 void Reload(Browser* browser, WindowOpenDisposition disposition); | 64 void Reload(Browser* browser, WindowOpenDisposition disposition); |
| 50 void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition); | 65 void ReloadIgnoringCache(Browser* browser, WindowOpenDisposition disposition); |
| 66 bool CanReload(const Browser* browser); |
| 51 void Home(Browser* browser, WindowOpenDisposition disposition); | 67 void Home(Browser* browser, WindowOpenDisposition disposition); |
| 52 void OpenCurrentURL(Browser* browser); | 68 void OpenCurrentURL(Browser* browser); |
| 53 void Stop(Browser* browser); | 69 void Stop(Browser* browser); |
| 54 void NewWindow(Browser* browser); | 70 void NewWindow(Browser* browser); |
| 55 void NewIncognitoWindow(Browser* browser); | 71 void NewIncognitoWindow(Browser* browser); |
| 56 void CloseWindow(Browser* browser); | 72 void CloseWindow(Browser* browser); |
| 57 void NewTab(Browser* browser); | 73 void NewTab(Browser* browser); |
| 58 void CloseTab(Browser* browser); | 74 void CloseTab(Browser* browser); |
| 75 void RestoreTab(Browser* browser); |
| 76 bool CanRestoreTab(const Browser* browser); |
| 59 void SelectNextTab(Browser* browser); | 77 void SelectNextTab(Browser* browser); |
| 60 void SelectPreviousTab(Browser* browser); | 78 void SelectPreviousTab(Browser* browser); |
| 61 void OpenTabpose(Browser* browser); // Mac-only | 79 void OpenTabpose(Browser* browser); // Mac-only |
| 62 void MoveTabNext(Browser* browser); | 80 void MoveTabNext(Browser* browser); |
| 63 void MoveTabPrevious(Browser* browser); | 81 void MoveTabPrevious(Browser* browser); |
| 64 void SelectNumberedTab(Browser* browser, int index); | 82 void SelectNumberedTab(Browser* browser, int index); |
| 65 void SelectLastTab(Browser* browser); | 83 void SelectLastTab(Browser* browser); |
| 66 void DuplicateTab(Browser* browser); | 84 void DuplicateTab(Browser* browser); |
| 85 bool CanDuplicateTab(const Browser* browser); |
| 67 void WriteCurrentURLToClipboard(Browser* browser); | 86 void WriteCurrentURLToClipboard(Browser* browser); |
| 68 void ConvertPopupToTabbedBrowser(Browser* browser); | 87 void ConvertPopupToTabbedBrowser(Browser* browser); |
| 69 void Exit(); | 88 void Exit(); |
| 70 void BookmarkCurrentPage(Browser* browser); | 89 void BookmarkCurrentPage(Browser* browser); |
| 90 bool CanBookmarkCurrentPage(const Browser* browser); |
| 91 void BookmarkAllTabs(Browser* browser); |
| 92 bool CanBookmarkAllTabs(const Browser* browser); |
| 71 void PinCurrentPageToStartScreen(Browser* browser); | 93 void PinCurrentPageToStartScreen(Browser* browser); |
| 72 void SavePage(Browser* browser); | 94 void SavePage(Browser* browser); |
| 95 bool CanSavePage(const Browser* browser); |
| 73 void ShowFindBar(Browser* browser); | 96 void ShowFindBar(Browser* browser); |
| 74 void ShowPageInfo(Browser* browser, | 97 void ShowPageInfo(Browser* browser, |
| 75 content::WebContents* web_contents, | 98 content::WebContents* web_contents, |
| 76 const GURL& url, | 99 const GURL& url, |
| 77 const content::SSLStatus& ssl, | 100 const content::SSLStatus& ssl, |
| 78 bool show_history); | 101 bool show_history); |
| 79 void ShowChromeToMobileBubble(Browser* browser); | 102 void ShowChromeToMobileBubble(Browser* browser); |
| 80 void Print(Browser* browser); | 103 void Print(Browser* browser); |
| 104 bool CanPrint(const Browser* browser); |
| 81 void AdvancedPrint(Browser* browser); | 105 void AdvancedPrint(Browser* browser); |
| 106 bool CanAdvancedPrint(const Browser* browser); |
| 82 void EmailPageLocation(Browser* browser); | 107 void EmailPageLocation(Browser* browser); |
| 108 bool CanEmailPageLocation(const Browser* browser); |
| 83 void Cut(Browser* browser); | 109 void Cut(Browser* browser); |
| 84 void Copy(Browser* browser); | 110 void Copy(Browser* browser); |
| 85 void Paste(Browser* browser); | 111 void Paste(Browser* browser); |
| 86 void Find(Browser* browser); | 112 void Find(Browser* browser); |
| 87 void FindNext(Browser* browser); | 113 void FindNext(Browser* browser); |
| 88 void FindPrevious(Browser* browser); | 114 void FindPrevious(Browser* browser); |
| 89 void FindInPage(Browser* browser, bool find_next, bool forward_direction); | 115 void FindInPage(Browser* browser, bool find_next, bool forward_direction); |
| 90 void Zoom(Browser* browser, content::PageZoom zoom); | 116 void Zoom(Browser* browser, content::PageZoom zoom); |
| 91 void FocusToolbar(Browser* browser); | 117 void FocusToolbar(Browser* browser); |
| 92 void FocusLocationBar(Browser* browser); | 118 void FocusLocationBar(Browser* browser); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 108 // Opens view-source tab for given tab contents. | 134 // Opens view-source tab for given tab contents. |
| 109 void ViewSource(Browser* browser, TabContents* tab); | 135 void ViewSource(Browser* browser, TabContents* tab); |
| 110 | 136 |
| 111 // Opens view-source tab for any frame within given tab contents. | 137 // Opens view-source tab for any frame within given tab contents. |
| 112 void ViewSource(Browser* browser, | 138 void ViewSource(Browser* browser, |
| 113 TabContents* tab, | 139 TabContents* tab, |
| 114 const GURL& url, | 140 const GURL& url, |
| 115 const std::string& content_state); | 141 const std::string& content_state); |
| 116 | 142 |
| 117 void ViewSelectedSource(Browser* browser); | 143 void ViewSelectedSource(Browser* browser); |
| 144 bool CanViewSource(const Browser* browser); |
| 145 |
| 146 bool CanCreateApplicationShortcuts(const Browser* browser); |
| 118 | 147 |
| 119 } // namespace chrome | 148 } // namespace chrome |
| 120 | 149 |
| 121 #endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_ | 150 #endif // CHROME_BROWSER_UI_BROWSER_COMMANDS_H_ |
| OLD | NEW |