diff options
Diffstat (limited to 'chrome/browser/extensions/extension_function.h')
-rw-r--r-- | chrome/browser/extensions/extension_function.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index e8a77dd..2766eb7 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -33,7 +33,6 @@ class Profile; class ExtensionFunction : public base::RefCounted<ExtensionFunction> { public: ExtensionFunction() : request_id_(-1), name_(""), has_callback_(false) {} - virtual ~ExtensionFunction() {} // Specifies the name of the function. void set_name(const std::string& name) { name_ = name; } @@ -69,6 +68,10 @@ class ExtensionFunction : public base::RefCounted<ExtensionFunction> { virtual void Run() = 0; protected: + friend class base::RefCounted<ExtensionFunction>; + + virtual ~ExtensionFunction() {} + // Gets the extension that called this function. This can return NULL for // async functions. Extension* GetExtension() { @@ -91,7 +94,6 @@ class ExtensionFunction : public base::RefCounted<ExtensionFunction> { // of this call. bool has_callback_; - private: DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); }; @@ -104,7 +106,6 @@ class ExtensionFunction : public base::RefCounted<ExtensionFunction> { class AsyncExtensionFunction : public ExtensionFunction { public: AsyncExtensionFunction() : args_(NULL), bad_message_(false) {} - virtual ~AsyncExtensionFunction() {} virtual void SetArgs(const Value* args); virtual const std::string GetResult(); @@ -119,6 +120,8 @@ class AsyncExtensionFunction : public ExtensionFunction { virtual bool RunImpl() = 0; protected: + virtual ~AsyncExtensionFunction() {} + void SendResponse(bool success); // Note: After Run() returns, dispatcher() can be NULL. Since these getters @@ -141,7 +144,6 @@ class AsyncExtensionFunction : public ExtensionFunction { // returning. The calling renderer process will be killed. bool bad_message_; - private: DISALLOW_COPY_AND_ASSIGN(AsyncExtensionFunction); }; @@ -164,6 +166,9 @@ class SyncExtensionFunction : public AsyncExtensionFunction { SendResponse(RunImpl()); } + protected: + virtual ~SyncExtensionFunction() {} + private: DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); }; |