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; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // shutdown when there are no active windows. | 53 // shutdown when there are no active windows. |
54 // | 54 // |
55 // TODO(stevenjb): Replace this with GetExtensionWindowController(). | 55 // TODO(stevenjb): Replace this with GetExtensionWindowController(). |
56 Browser* GetCurrentBrowser(); | 56 Browser* GetCurrentBrowser(); |
57 | 57 |
58 // Same as above but uses WindowControllerList instead of BrowserList. | 58 // Same as above but uses WindowControllerList instead of BrowserList. |
59 extensions::WindowController* GetExtensionWindowController(); | 59 extensions::WindowController* GetExtensionWindowController(); |
60 | 60 |
61 // 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 |
62 // contents then defaults to the foremost one. | 62 // contents then defaults to the foremost one. |
63 virtual content::WebContents* GetAssociatedWebContents() override; | 63 content::WebContents* GetAssociatedWebContents() override; |
64 | 64 |
65 protected: | 65 protected: |
66 virtual ~ChromeUIThreadExtensionFunction(); | 66 ~ChromeUIThreadExtensionFunction() override; |
67 }; | 67 }; |
68 | 68 |
69 // A chrome specific analog to AsyncExtensionFunction. This has access to a | 69 // A chrome specific analog to AsyncExtensionFunction. This has access to a |
70 // chrome Profile. | 70 // chrome Profile. |
71 // | 71 // |
72 // DEPRECATED: Please consider inherting UIThreadExtensionFunction or | 72 // DEPRECATED: Please consider inherting UIThreadExtensionFunction or |
73 // AsyncExtensionFunction directly. Then if you need access to Chrome details, | 73 // AsyncExtensionFunction directly. Then if you need access to Chrome details, |
74 // you can construct a ChromeExtensionFunctionDetails object within your | 74 // you can construct a ChromeExtensionFunctionDetails object within your |
75 // function implementation. | 75 // function implementation. |
76 class ChromeAsyncExtensionFunction : public ChromeUIThreadExtensionFunction { | 76 class ChromeAsyncExtensionFunction : public ChromeUIThreadExtensionFunction { |
77 public: | 77 public: |
78 ChromeAsyncExtensionFunction(); | 78 ChromeAsyncExtensionFunction(); |
79 | 79 |
80 protected: | 80 protected: |
81 virtual ~ChromeAsyncExtensionFunction(); | 81 ~ChromeAsyncExtensionFunction() override; |
82 | 82 |
83 // Deprecated, see AsyncExtensionFunction::RunAsync. | 83 // Deprecated, see AsyncExtensionFunction::RunAsync. |
84 virtual bool RunAsync() = 0; | 84 virtual bool RunAsync() = 0; |
85 | 85 |
86 // ValidationFailure override to match RunAsync(). | 86 // ValidationFailure override to match RunAsync(). |
87 static bool ValidationFailure(ChromeAsyncExtensionFunction* function); | 87 static bool ValidationFailure(ChromeAsyncExtensionFunction* function); |
88 | 88 |
89 private: | 89 private: |
90 virtual ResponseAction Run() override; | 90 ResponseAction Run() override; |
91 }; | 91 }; |
92 | 92 |
93 // A chrome specific analog to SyncExtensionFunction. This has access to a | 93 // A chrome specific analog to SyncExtensionFunction. This has access to a |
94 // chrome Profile. | 94 // chrome Profile. |
95 // | 95 // |
96 // DEPRECATED: Please consider inherting UIThreadExtensionFunction or | 96 // DEPRECATED: Please consider inherting UIThreadExtensionFunction or |
97 // SyncExtensionFunction directly. Then if you need access to Chrome details, | 97 // SyncExtensionFunction directly. Then if you need access to Chrome details, |
98 // you can construct a ChromeExtensionFunctionDetails object within your | 98 // you can construct a ChromeExtensionFunctionDetails object within your |
99 // function implementation. | 99 // function implementation. |
100 class ChromeSyncExtensionFunction : public ChromeUIThreadExtensionFunction { | 100 class ChromeSyncExtensionFunction : public ChromeUIThreadExtensionFunction { |
101 public: | 101 public: |
102 ChromeSyncExtensionFunction(); | 102 ChromeSyncExtensionFunction(); |
103 | 103 |
104 protected: | 104 protected: |
105 virtual ~ChromeSyncExtensionFunction(); | 105 ~ChromeSyncExtensionFunction() override; |
106 | 106 |
107 // Deprecated, see SyncExtensionFunction::RunSync. | 107 // Deprecated, see SyncExtensionFunction::RunSync. |
108 virtual bool RunSync() = 0; | 108 virtual bool RunSync() = 0; |
109 | 109 |
110 // ValidationFailure override to match RunSync(). | 110 // ValidationFailure override to match RunSync(). |
111 static bool ValidationFailure(ChromeSyncExtensionFunction* function); | 111 static bool ValidationFailure(ChromeSyncExtensionFunction* function); |
112 | 112 |
113 private: | 113 private: |
114 virtual ResponseAction Run() override; | 114 ResponseAction Run() override; |
115 }; | 115 }; |
116 | 116 |
117 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ | 117 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ |
OLD | NEW |