Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1958)

Unified Diff: chrome/browser/extensions/extension_function.h

Issue 10815028: Make ActiveTabPermissionManager also grant the tabs permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..adef96a26b2bea8172565f9969be275a86001b7d 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 has permission to run.
+ //
+ // 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();
+
// 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
« no previous file with comments | « chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc ('k') | chrome/browser/extensions/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698