Chromium Code Reviews| Index: chrome/browser/extensions/extension_function.h |
| diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h |
| index 0698d3bcbc609a373848990bed87a7901045514d..dd4aac52243c2e481bf35cb1d787cc4311affa74 100644 |
| --- a/chrome/browser/extensions/extension_function.h |
| +++ b/chrome/browser/extensions/extension_function.h |
| @@ -44,12 +44,16 @@ namespace extensions { |
| class WindowController; |
| } |
| +#ifdef NDEBUG |
| #define EXTENSION_FUNCTION_VALIDATE(test) do { \ |
| if (!(test)) { \ |
| bad_message_ = true; \ |
| return false; \ |
| } \ |
| } while (0) |
| +#else // NDEBUG |
| +#define EXTENSION_FUNCTION_VALIDATE(test) CHECK(test) |
| +#endif // NDEBUG |
| #define EXTENSION_FUNCTION_ERROR(error) do { \ |
| error_ = error; \ |
| @@ -79,6 +83,15 @@ class ExtensionFunction |
| virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction(); |
| virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); |
| + // Returns true if the function permission to run. |
|
Aaron Boodman
2012/07/31 14:53:43
^has
not at google - send to devlin
2012/07/31 15:09:05
Done.
|
| + // |
| + // The default implementation is to check the Extension's permissions against |
| + // what this function requires to run, but some APIs may require finer |
| + // grained control, such as tabs.executeScript being allowed for active tabs. |
| + // |
| + // This will be run after the function has been set up but before Run(). |
| + virtual bool HasPermission(); |
|
Aaron Boodman
2012/07/31 14:53:43
Neat.
|
| + |
| // Execute the API. Clients should initialize the ExtensionFunction using |
| // SetArgs(), set_request_id(), and the other setters before calling this |
| // method. Derived classes should be ready to return GetResultList() and |