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 "chrome/browser/extensions/chrome_extension_function_details.h" | 8 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
9 #include "extensions/browser/extension_function.h" | 9 #include "extensions/browser/extension_function.h" |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // This method can return NULL if there is no matching browser, which can | 47 // This method can return NULL if there is no matching browser, which can |
48 // happen if only incognito windows are open, or early in startup or shutdown | 48 // happen if only incognito windows are open, or early in startup or shutdown |
49 // shutdown when there are no active windows. | 49 // shutdown when there are no active windows. |
50 // | 50 // |
51 // TODO(stevenjb): Replace this with GetExtensionWindowController(). | 51 // TODO(stevenjb): Replace this with GetExtensionWindowController(). |
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 void SetError(const std::string& error); |
| 58 |
57 // ExtensionFunction: | 59 // ExtensionFunction: |
58 content::WebContents* GetAssociatedWebContents() override; | 60 content::WebContents* GetAssociatedWebContents() override; |
59 void SetError(const std::string& error) override; | |
60 const std::string& GetError() const override; | 61 const std::string& GetError() const override; |
61 | 62 |
62 protected: | 63 protected: |
63 ~ChromeUIThreadExtensionFunction() override; | 64 ~ChromeUIThreadExtensionFunction() override; |
64 | 65 |
65 // Responds with success/failure. |results_| or |error_| should be set | 66 // Responds with success/failure. |results_| or |error_| should be set |
66 // accordingly. | 67 // accordingly. |
67 void SendResponse(bool success); | 68 void SendResponse(bool success); |
68 | 69 |
69 // Sets a single Value as the results of the function. | 70 // Sets a single Value as the results of the function. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 static bool ValidationFailure(ChromeSyncExtensionFunction* function); | 133 static bool ValidationFailure(ChromeSyncExtensionFunction* function); |
133 | 134 |
134 private: | 135 private: |
135 // If you're hitting a compile error here due to "final" - great! You're doing | 136 // If you're hitting a compile error here due to "final" - great! You're doing |
136 // the right thing, you just need to extend ChromeUIThreadExtensionFunction | 137 // the right thing, you just need to extend ChromeUIThreadExtensionFunction |
137 // instead of ChromeSyncExtensionFunction. | 138 // instead of ChromeSyncExtensionFunction. |
138 ResponseAction Run() final; | 139 ResponseAction Run() final; |
139 }; | 140 }; |
140 | 141 |
141 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ | 142 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_ |
OLD | NEW |