Chromium Code Reviews| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 // | 117 // |
| 118 // This will be run after the function has been set up but before Run(). | 118 // This will be run after the function has been set up but before Run(). |
| 119 virtual bool HasPermission(); | 119 virtual bool HasPermission(); |
| 120 | 120 |
| 121 // Execute the API. Clients should initialize the ExtensionFunction using | 121 // Execute the API. Clients should initialize the ExtensionFunction using |
| 122 // SetArgs(), set_request_id(), and the other setters before calling this | 122 // SetArgs(), set_request_id(), and the other setters before calling this |
| 123 // method. Derived classes should be ready to return GetResultList() and | 123 // method. Derived classes should be ready to return GetResultList() and |
| 124 // GetError() before returning from this function. | 124 // GetError() before returning from this function. |
| 125 // Note that once Run() returns, dispatcher() can be NULL, so be sure to | 125 // Note that once Run() returns, dispatcher() can be NULL, so be sure to |
| 126 // NULL-check. | 126 // NULL-check. |
| 127 virtual void Run(); | 127 void Run(); |
|
Ken Rockot(use gerrit already)
2014/04/25 04:01:36
The "Derived classes..." part of this documentatio
not at google - send to devlin
2014/04/28 22:38:15
oops missed this comment. i have the comment fix i
| |
| 128 | 128 |
| 129 // Gets whether quota should be applied to this individual function | 129 // Gets whether quota should be applied to this individual function |
| 130 // invocation. This is different to GetQuotaLimitHeuristics which is only | 130 // invocation. This is different to GetQuotaLimitHeuristics which is only |
| 131 // invoked once and then cached. | 131 // invoked once and then cached. |
| 132 // | 132 // |
| 133 // Returns false by default. | 133 // Returns false by default. |
| 134 virtual bool ShouldSkipQuotaLimiting() const; | 134 virtual bool ShouldSkipQuotaLimiting() const; |
| 135 | 135 |
| 136 // Optionally adds one or multiple QuotaLimitHeuristic instances suitable for | 136 // Optionally adds one or multiple QuotaLimitHeuristic instances suitable for |
| 137 // this function to |heuristics|. The ownership of the new QuotaLimitHeuristic | 137 // this function to |heuristics|. The ownership of the new QuotaLimitHeuristic |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 // *relative to the browser's UI thread*. Note that this has nothing to do with | 495 // *relative to the browser's UI thread*. Note that this has nothing to do with |
| 496 // running synchronously relative to the extension process. From the extension | 496 // running synchronously relative to the extension process. From the extension |
| 497 // process's point of view, the function is still asynchronous. | 497 // process's point of view, the function is still asynchronous. |
| 498 // | 498 // |
| 499 // This kind of function is convenient for implementing simple APIs that just | 499 // This kind of function is convenient for implementing simple APIs that just |
| 500 // need to interact with things on the browser UI thread. | 500 // need to interact with things on the browser UI thread. |
| 501 class SyncExtensionFunction : public UIThreadExtensionFunction { | 501 class SyncExtensionFunction : public UIThreadExtensionFunction { |
| 502 public: | 502 public: |
| 503 SyncExtensionFunction(); | 503 SyncExtensionFunction(); |
| 504 | 504 |
| 505 virtual void Run() OVERRIDE; | 505 virtual bool RunImpl() OVERRIDE; |
| 506 | 506 |
| 507 protected: | 507 protected: |
| 508 virtual bool RunSync() = 0; | |
| 509 | |
| 508 virtual ~SyncExtensionFunction(); | 510 virtual ~SyncExtensionFunction(); |
| 509 }; | 511 }; |
| 510 | 512 |
| 511 class SyncIOThreadExtensionFunction : public IOThreadExtensionFunction { | 513 class SyncIOThreadExtensionFunction : public IOThreadExtensionFunction { |
| 512 public: | 514 public: |
| 513 SyncIOThreadExtensionFunction(); | 515 SyncIOThreadExtensionFunction(); |
| 514 | 516 |
| 515 virtual void Run() OVERRIDE; | 517 virtual bool RunImpl() OVERRIDE; |
| 516 | 518 |
| 517 protected: | 519 protected: |
| 520 virtual bool RunSync() = 0; | |
| 521 | |
| 518 virtual ~SyncIOThreadExtensionFunction(); | 522 virtual ~SyncIOThreadExtensionFunction(); |
| 519 }; | 523 }; |
| 520 | 524 |
| 521 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 525 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| OLD | NEW |