OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ |
7 | 7 |
8 #include "extensions/browser/extension_function.h" | 8 #include "extensions/browser/extension_function.h" |
9 | 9 |
10 class Browser; | 10 class Browser; |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 class WindowController; | 18 class WindowController; |
19 } | 19 } |
20 | 20 |
21 // A chrome specific analog to AsyncExtensionFunction. This has access | 21 // A chrome specific analog to AsyncExtensionFunction. This has access to a |
22 // the a chrome Profile. | 22 // chrome Profile. |
23 class ChromeAsyncExtensionFunction : public UIThreadExtensionFunction { | 23 class ChromeUIThreadExtensionFunction : public UIThreadExtensionFunction { |
24 public: | 24 public: |
25 ChromeAsyncExtensionFunction(); | 25 ChromeUIThreadExtensionFunction(); |
26 | 26 |
27 Profile* GetProfile() const; | 27 Profile* GetProfile() const; |
28 | 28 |
29 // Returns true if this function (and the profile and extension that it was | 29 // Returns true if this function (and the profile and extension that it was |
30 // invoked from) can operate on the window wrapped by |window_controller|. | 30 // invoked from) can operate on the window wrapped by |window_controller|. |
31 bool CanOperateOnWindow(const extensions::WindowController* window_controller) | 31 bool CanOperateOnWindow(const extensions::WindowController* window_controller) |
32 const; | 32 const; |
33 | 33 |
34 // Gets the "current" browser, if any. | 34 // Gets the "current" browser, if any. |
35 // | 35 // |
(...skipping 16 matching lines...) Expand all Loading... |
52 Browser* GetCurrentBrowser(); | 52 Browser* GetCurrentBrowser(); |
53 | 53 |
54 // Same as above but uses WindowControllerList instead of BrowserList. | 54 // Same as above but uses WindowControllerList instead of BrowserList. |
55 extensions::WindowController* GetExtensionWindowController(); | 55 extensions::WindowController* GetExtensionWindowController(); |
56 | 56 |
57 // Gets the "current" web contents if any. If there is no associated web | 57 // Gets the "current" web contents if any. If there is no associated web |
58 // contents then defaults to the foremost one. | 58 // contents then defaults to the foremost one. |
59 virtual content::WebContents* GetAssociatedWebContents() OVERRIDE; | 59 virtual content::WebContents* GetAssociatedWebContents() OVERRIDE; |
60 | 60 |
61 protected: | 61 protected: |
62 virtual ~ChromeAsyncExtensionFunction(); | 62 virtual ~ChromeUIThreadExtensionFunction(); |
63 }; | 63 }; |
64 | 64 |
65 // A chrome specific analog to SyncExtensionFunction. This has access | 65 // A chrome specific analog to AsyncExtensionFunction. This has access to a |
66 // the a chrome Profile. | 66 // chrome Profile. |
67 class ChromeSyncExtensionFunction : public ChromeAsyncExtensionFunction { | 67 class ChromeAsyncExtensionFunction : public ChromeUIThreadExtensionFunction { |
| 68 public: |
| 69 ChromeAsyncExtensionFunction(); |
| 70 |
| 71 protected: |
| 72 virtual ~ChromeAsyncExtensionFunction(); |
| 73 |
| 74 // Deprecated, see AsyncExtensionFunction::RunAsync. |
| 75 virtual bool RunAsync() = 0; |
| 76 |
| 77 private: |
| 78 virtual ResponseAction Run() OVERRIDE; |
| 79 }; |
| 80 |
| 81 // A chrome specific analog to SyncExtensionFunction. This has access to a |
| 82 // chrome Profile. |
| 83 class ChromeSyncExtensionFunction : public ChromeUIThreadExtensionFunction { |
68 public: | 84 public: |
69 ChromeSyncExtensionFunction(); | 85 ChromeSyncExtensionFunction(); |
70 | 86 |
71 virtual bool RunImpl() OVERRIDE; | 87 protected: |
| 88 virtual ~ChromeSyncExtensionFunction(); |
72 | 89 |
| 90 // Deprecated, see SyncExtensionFunction::RunSync. |
73 virtual bool RunSync() = 0; | 91 virtual bool RunSync() = 0; |
74 | 92 |
75 protected: | 93 private: |
76 virtual ~ChromeSyncExtensionFunction(); | 94 virtual ResponseAction Run() OVERRIDE; |
77 }; | 95 }; |
78 | 96 |
79 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ |
OLD | NEW |