OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); | 77 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); |
78 | 78 |
79 // Execute the API. Clients should initialize the ExtensionFunction using | 79 // Execute the API. Clients should initialize the ExtensionFunction using |
80 // SetArgs(), set_request_id(), and the other setters before calling this | 80 // SetArgs(), set_request_id(), and the other setters before calling this |
81 // method. Derived classes should be ready to return GetResultValue() and | 81 // method. Derived classes should be ready to return GetResultValue() and |
82 // GetError() before returning from this function. | 82 // GetError() before returning from this function. |
83 // Note that once Run() returns, dispatcher() can be NULL, so be sure to | 83 // Note that once Run() returns, dispatcher() can be NULL, so be sure to |
84 // NULL-check. | 84 // NULL-check. |
85 virtual void Run(); | 85 virtual void Run(); |
86 | 86 |
| 87 // Gets whether quota should be applied to this individual function |
| 88 // invocation. This is different to GetQuotaLimitHeuristics which is only |
| 89 // invoked once and then cached. |
| 90 // |
| 91 // Returns false by default. |
| 92 virtual bool ShouldSkipQuotaLimiting() const; |
| 93 |
87 // Optionally adds one or multiple QuotaLimitHeuristic instances suitable for | 94 // Optionally adds one or multiple QuotaLimitHeuristic instances suitable for |
88 // this function to |heuristics|. The ownership of the new QuotaLimitHeuristic | 95 // this function to |heuristics|. The ownership of the new QuotaLimitHeuristic |
89 // instances is passed to the owner of |heuristics|. | 96 // instances is passed to the owner of |heuristics|. |
90 // No quota limiting by default. | 97 // No quota limiting by default. |
| 98 // |
| 99 // Only called once per lifetime of the ExtensionsQuotaService. |
91 virtual void GetQuotaLimitHeuristics( | 100 virtual void GetQuotaLimitHeuristics( |
92 QuotaLimitHeuristics* heuristics) const {} | 101 QuotaLimitHeuristics* heuristics) const {} |
93 | 102 |
94 // Called when the quota limit has been exceeded. The default implementation | 103 // Called when the quota limit has been exceeded. The default implementation |
95 // returns an error. | 104 // returns an error. |
96 virtual void OnQuotaExceeded(); | 105 virtual void OnQuotaExceeded(); |
97 | 106 |
98 // Specifies the raw arguments to the function, as a JSON value. | 107 // Specifies the raw arguments to the function, as a JSON value. |
99 virtual void SetArgs(const base::ListValue* args); | 108 virtual void SetArgs(const base::ListValue* args); |
100 | 109 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 public: | 412 public: |
404 SyncIOThreadExtensionFunction(); | 413 SyncIOThreadExtensionFunction(); |
405 | 414 |
406 virtual void Run() OVERRIDE; | 415 virtual void Run() OVERRIDE; |
407 | 416 |
408 protected: | 417 protected: |
409 virtual ~SyncIOThreadExtensionFunction(); | 418 virtual ~SyncIOThreadExtensionFunction(); |
410 }; | 419 }; |
411 | 420 |
412 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 421 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |