diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 23:09:10 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 23:09:10 +0000 |
commit | 73404a373b7c8ca68793d58a0750d086dc49fdda (patch) | |
tree | eb9a0569b42fd3235913754df7a2baf79abb9e4f /chrome/browser/extensions/extension_function.h | |
parent | bc5987b6febaa0562c1f21e91197937a53116a30 (diff) | |
download | chromium_src-73404a373b7c8ca68793d58a0750d086dc49fdda.zip chromium_src-73404a373b7c8ca68793d58a0750d086dc49fdda.tar.gz chromium_src-73404a373b7c8ca68793d58a0750d086dc49fdda.tar.bz2 |
A subset of the bookmarks API- missing events- missing unit tests- missing ability to change URL
Review URL: http://codereview.chromium.org/77003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13977 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function.h')
-rw-r--r-- | chrome/browser/extensions/extension_function.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index 421df81..ed8fe9e 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -11,12 +11,21 @@ #include "base/scoped_ptr.h" class ExtensionFunctionDispatcher; +class Profile; + +#define EXTENSION_FUNCTION_VALIDATE(test) do { \ + if (!test) { \ + bad_message_ = true; \ + return false; \ + } \ + } while (0) // Base class for an extension function. // TODO(aa): This will have to become reference counted when we introduce APIs // that live beyond a single stack frame. class ExtensionFunction { public: + ExtensionFunction() : bad_message_(false) {} virtual ~ExtensionFunction() {} void set_dispatcher(ExtensionFunctionDispatcher* dispatcher) { @@ -43,6 +52,8 @@ class ExtensionFunction { protected: void SendResponse(bool success); + Profile* profile(); + // The arguments to the API. Only non-null if argument were specfied. Value* args_; @@ -54,9 +65,15 @@ class ExtensionFunction { // class before Run() returns. std::string error_; + // Any class that gets a malformed message should set this to true before + // returning. The calling renderer process will be killed. + bool bad_message_; + private: ExtensionFunctionDispatcher* dispatcher_; int callback_id_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); }; @@ -69,6 +86,8 @@ class ExtensionFunction { // need to interact with things on the browser UI thread. class SyncExtensionFunction : public ExtensionFunction { public: + SyncExtensionFunction() {} + // Derived classes should implement this method to do their work and return // success/failure. virtual bool RunImpl() = 0; @@ -76,6 +95,9 @@ class SyncExtensionFunction : public ExtensionFunction { virtual void Run() { SendResponse(RunImpl()); } + + private: + DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); }; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |