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 EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // by the corresponding |s*|: | 301 // by the corresponding |s*|: |
302 // Error("Error in *: *", "foo", "bar") <--> Error("Error in foo: bar"). | 302 // Error("Error in *: *", "foo", "bar") <--> Error("Error in foo: bar"). |
303 ResponseValue Error(const std::string& format, const std::string& s1); | 303 ResponseValue Error(const std::string& format, const std::string& s1); |
304 ResponseValue Error(const std::string& format, | 304 ResponseValue Error(const std::string& format, |
305 const std::string& s1, | 305 const std::string& s1, |
306 const std::string& s2); | 306 const std::string& s2); |
307 ResponseValue Error(const std::string& format, | 307 ResponseValue Error(const std::string& format, |
308 const std::string& s1, | 308 const std::string& s1, |
309 const std::string& s2, | 309 const std::string& s2, |
310 const std::string& s3); | 310 const std::string& s3); |
| 311 // Error with a list of arguments |args| to pass to caller. TAKES OWNERSHIP. |
| 312 // Using this ResponseValue indicates something is wrong with the API. |
| 313 // It shouldn't be possible to have both an error *and* some arguments. |
| 314 // Some legacy APIs do rely on it though, like webstorePrivate. |
| 315 ResponseValue ErrorWithArguments(scoped_ptr<base::ListValue> args, |
| 316 const std::string& error); |
311 // Bad message. A ResponseValue equivalent to EXTENSION_FUNCTION_VALIDATE(), | 317 // Bad message. A ResponseValue equivalent to EXTENSION_FUNCTION_VALIDATE(), |
312 // so this will actually kill the renderer and not respond at all. | 318 // so this will actually kill the renderer and not respond at all. |
313 ResponseValue BadMessage(); | 319 ResponseValue BadMessage(); |
314 | 320 |
315 // ResponseActions. | 321 // ResponseActions. |
316 // | 322 // |
317 // Respond to the extension immediately with |result|. | 323 // Respond to the extension immediately with |result|. |
318 ResponseAction RespondNow(ResponseValue result); | 324 ResponseAction RespondNow(ResponseValue result); |
319 // Don't respond now, but promise to call Respond(...) later. | 325 // Don't respond now, but promise to call Respond(...) later. |
320 ResponseAction RespondLater(); | 326 ResponseAction RespondLater(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 virtual bool RunSync() = 0; | 631 virtual bool RunSync() = 0; |
626 | 632 |
627 // ValidationFailure override to match RunSync(). | 633 // ValidationFailure override to match RunSync(). |
628 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); | 634 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); |
629 | 635 |
630 private: | 636 private: |
631 ResponseAction Run() override; | 637 ResponseAction Run() override; |
632 }; | 638 }; |
633 | 639 |
634 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 640 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
OLD | NEW |