diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 01:43:02 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 01:43:02 +0000 |
commit | d13950ec676bc8aa9ea493e89a4cd1aee4a41913 (patch) | |
tree | 548e23868022937d34b2966a2e08f2a3d6510bbd /chrome/browser/extensions/extension_function.h | |
parent | f8c726650ef5fff6a9cc37411193c186a16f673f (diff) | |
download | chromium_src-d13950ec676bc8aa9ea493e89a4cd1aee4a41913.zip chromium_src-d13950ec676bc8aa9ea493e89a4cd1aee4a41913.tar.gz chromium_src-d13950ec676bc8aa9ea493e89a4cd1aee4a41913.tar.bz2 |
Add ExtensionsQuotaService to limit abusive amounts of requests
to mutating extension functions, as discussed on chromium-dev and
in Extensions quotaserver design doc.
Add a hook in the dispatcher to have the quota service assess the request.
Wire up bookmarks.{create, move, remove, update} to the service.
BUG=19899
TEST=ExtensionsQuotaServiceTest, QuotaLimitHeuristicTest (both new)
Review URL: http://codereview.chromium.org/441006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33770 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 be74f36..6db6443 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ #include <string> +#include <list> #include "base/values.h" #include "base/scoped_ptr.h" @@ -14,6 +15,7 @@ class ExtensionFunctionDispatcher; class Profile; +class QuotaLimitHeuristic; #define EXTENSION_FUNCTION_VALIDATE(test) do { \ if (!(test)) { \ @@ -48,10 +50,15 @@ class ExtensionFunction : public base::RefCounted<ExtensionFunction> { // Retrieves any error string from the function. virtual const std::string GetError() = 0; + // Returns a quota limit heuristic suitable for this function. + // No quota limiting by default. + virtual void GetQuotaLimitHeuristics( + std::list<QuotaLimitHeuristic*>* heuristics) const {} + void set_dispatcher_peer(ExtensionFunctionDispatcher::Peer* peer) { peer_ = peer; } - ExtensionFunctionDispatcher* dispatcher() { + ExtensionFunctionDispatcher* dispatcher() const { return peer_->dispatcher_; } @@ -134,7 +141,7 @@ class AsyncExtensionFunction : public ExtensionFunction { // Note: After Run() returns, dispatcher() can be NULL. Since these getters // rely on dispatcher(), make sure it is valid before using them. std::string extension_id(); - Profile* profile(); + Profile* profile() const; // The arguments to the API. Only non-null if argument were specified. scoped_ptr<Value> args_; |