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 to a | 21 // A chrome specific analog to AsyncExtensionFunction. This has access to a |
22 // chrome Profile. | 22 // chrome Profile. |
| 23 // |
| 24 // DEPRECATED: Please consider inherting UIThreadExtensionFunction directly. |
| 25 // Then if you need access to Chrome details, you can construct a |
| 26 // ChromeExtensionFunctionDetails object within your function implementation. |
23 class ChromeUIThreadExtensionFunction : public UIThreadExtensionFunction { | 27 class ChromeUIThreadExtensionFunction : public UIThreadExtensionFunction { |
24 public: | 28 public: |
25 ChromeUIThreadExtensionFunction(); | 29 ChromeUIThreadExtensionFunction(); |
26 | 30 |
27 Profile* GetProfile() const; | 31 Profile* GetProfile() const; |
28 | 32 |
29 // Returns true if this function (and the profile and extension that it was | 33 // 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|. | 34 // invoked from) can operate on the window wrapped by |window_controller|. |
31 bool CanOperateOnWindow(const extensions::WindowController* window_controller) | 35 bool CanOperateOnWindow(const extensions::WindowController* window_controller) |
32 const; | 36 const; |
(...skipping 24 matching lines...) Expand all Loading... |
57 // Gets the "current" web contents if any. If there is no associated web | 61 // Gets the "current" web contents if any. If there is no associated web |
58 // contents then defaults to the foremost one. | 62 // contents then defaults to the foremost one. |
59 virtual content::WebContents* GetAssociatedWebContents() OVERRIDE; | 63 virtual content::WebContents* GetAssociatedWebContents() OVERRIDE; |
60 | 64 |
61 protected: | 65 protected: |
62 virtual ~ChromeUIThreadExtensionFunction(); | 66 virtual ~ChromeUIThreadExtensionFunction(); |
63 }; | 67 }; |
64 | 68 |
65 // A chrome specific analog to AsyncExtensionFunction. This has access to a | 69 // A chrome specific analog to AsyncExtensionFunction. This has access to a |
66 // chrome Profile. | 70 // chrome Profile. |
| 71 // |
| 72 // DEPRECATED: Please consider inherting UIThreadExtensionFunction or |
| 73 // AsyncExtensionFunction directly. Then if you need access to Chrome details, |
| 74 // you can construct a ChromeExtensionFunctionDetails object within your |
| 75 // function implementation. |
67 class ChromeAsyncExtensionFunction : public ChromeUIThreadExtensionFunction { | 76 class ChromeAsyncExtensionFunction : public ChromeUIThreadExtensionFunction { |
68 public: | 77 public: |
69 ChromeAsyncExtensionFunction(); | 78 ChromeAsyncExtensionFunction(); |
70 | 79 |
71 protected: | 80 protected: |
72 virtual ~ChromeAsyncExtensionFunction(); | 81 virtual ~ChromeAsyncExtensionFunction(); |
73 | 82 |
74 // Deprecated, see AsyncExtensionFunction::RunAsync. | 83 // Deprecated, see AsyncExtensionFunction::RunAsync. |
75 virtual bool RunAsync() = 0; | 84 virtual bool RunAsync() = 0; |
76 | 85 |
77 // ValidationFailure override to match RunAsync(). | 86 // ValidationFailure override to match RunAsync(). |
78 static bool ValidationFailure(ChromeAsyncExtensionFunction* function); | 87 static bool ValidationFailure(ChromeAsyncExtensionFunction* function); |
79 | 88 |
80 private: | 89 private: |
81 virtual ResponseAction Run() OVERRIDE; | 90 virtual ResponseAction Run() OVERRIDE; |
82 }; | 91 }; |
83 | 92 |
84 // A chrome specific analog to SyncExtensionFunction. This has access to a | 93 // A chrome specific analog to SyncExtensionFunction. This has access to a |
85 // chrome Profile. | 94 // chrome Profile. |
| 95 // |
| 96 // DEPRECATED: Please consider inherting UIThreadExtensionFunction or |
| 97 // SyncExtensionFunction directly. Then if you need access to Chrome details, |
| 98 // you can construct a ChromeExtensionFunctionDetails object within your |
| 99 // function implementation. |
86 class ChromeSyncExtensionFunction : public ChromeUIThreadExtensionFunction { | 100 class ChromeSyncExtensionFunction : public ChromeUIThreadExtensionFunction { |
87 public: | 101 public: |
88 ChromeSyncExtensionFunction(); | 102 ChromeSyncExtensionFunction(); |
89 | 103 |
90 protected: | 104 protected: |
91 virtual ~ChromeSyncExtensionFunction(); | 105 virtual ~ChromeSyncExtensionFunction(); |
92 | 106 |
93 // Deprecated, see SyncExtensionFunction::RunSync. | 107 // Deprecated, see SyncExtensionFunction::RunSync. |
94 virtual bool RunSync() = 0; | 108 virtual bool RunSync() = 0; |
95 | 109 |
96 // ValidationFailure override to match RunSync(). | 110 // ValidationFailure override to match RunSync(). |
97 static bool ValidationFailure(ChromeSyncExtensionFunction* function); | 111 static bool ValidationFailure(ChromeSyncExtensionFunction* function); |
98 | 112 |
99 private: | 113 private: |
100 virtual ResponseAction Run() OVERRIDE; | 114 virtual ResponseAction Run() OVERRIDE; |
101 }; | 115 }; |
102 | 116 |
103 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ | 117 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ |
OLD | NEW |