diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-10 16:41:27 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-10 16:41:27 +0000 |
commit | 5c4266928220b850dc96474953f0b3a29739e0d3 (patch) | |
tree | 0981198815b7d83ab1ccdb0fc358db8637618c05 /chrome/browser/extensions/extension_function.h | |
parent | 479d5bc48969f6de924471de27638409db848229 (diff) | |
download | chromium_src-5c4266928220b850dc96474953f0b3a29739e0d3.zip chromium_src-5c4266928220b850dc96474953f0b3a29739e0d3.tar.gz chromium_src-5c4266928220b850dc96474953f0b3a29739e0d3.tar.bz2 |
Add getLanguage function to tab extension.
BUG=none
TEST=enable extensions using the toolstip.html code (added with this CL) and load pages in different languages. The corresponding language should appear in the bottom left after the page is loadedm or when the button is clicked, or when you navigate back to that tab after visiting some other tab.
Review URL: http://codereview.chromium.org/150062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function.h')
-rw-r--r-- | chrome/browser/extensions/extension_function.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index 7798a19..ed2f9d0 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -93,7 +93,14 @@ class AsyncExtensionFunction : public ExtensionFunction { virtual void SetArgs(const std::string& args); virtual const std::string GetResult(); virtual const std::string GetError() { return error_; } - virtual void Run() = 0; + virtual void Run() { + if (!RunImpl()) + SendResponse(false); + } + + // Derived classes should implement this method to do their work and return + // success/failure. + virtual bool RunImpl() = 0; protected: void SendResponse(bool success); @@ -107,7 +114,7 @@ class AsyncExtensionFunction : public ExtensionFunction { Value* args_; // The result of the API. This should be populated by the derived class before - // Run() returns. + // SendResponse() is called. scoped_ptr<Value> result_; // Any detailed error from the API. This should be populated by the derived |