OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // | 194 // |
195 // Only called once per lifetime of the QuotaService. | 195 // Only called once per lifetime of the QuotaService. |
196 virtual void GetQuotaLimitHeuristics( | 196 virtual void GetQuotaLimitHeuristics( |
197 extensions::QuotaLimitHeuristics* heuristics) const {} | 197 extensions::QuotaLimitHeuristics* heuristics) const {} |
198 | 198 |
199 // Called when the quota limit has been exceeded. The default implementation | 199 // Called when the quota limit has been exceeded. The default implementation |
200 // returns an error. | 200 // returns an error. |
201 virtual void OnQuotaExceeded(const std::string& violation_error); | 201 virtual void OnQuotaExceeded(const std::string& violation_error); |
202 | 202 |
203 // Specifies the raw arguments to the function, as a JSON value. | 203 // Specifies the raw arguments to the function, as a JSON value. |
| 204 // TODO(dcheng): This should take a const ref. |
204 virtual void SetArgs(const base::ListValue* args); | 205 virtual void SetArgs(const base::ListValue* args); |
205 | 206 |
206 // Sets a single Value as the results of the function. | 207 // Sets a single Value as the results of the function. |
207 void SetResult(std::unique_ptr<base::Value> result); | 208 void SetResult(std::unique_ptr<base::Value> result); |
208 // As above, but deprecated. TODO(estade): remove. | |
209 void SetResult(base::Value* result); | |
210 | 209 |
211 // Sets multiple Values as the results of the function. | 210 // Sets multiple Values as the results of the function. |
212 void SetResultList(std::unique_ptr<base::ListValue> results); | 211 void SetResultList(std::unique_ptr<base::ListValue> results); |
213 | 212 |
214 // Retrieves the results of the function as a ListValue. | 213 // Retrieves the results of the function as a ListValue. |
215 const base::ListValue* GetResultList() const; | 214 const base::ListValue* GetResultList() const; |
216 | 215 |
217 // Retrieves any error string from the function. | 216 // Retrieves any error string from the function. |
218 virtual std::string GetError() const; | 217 virtual std::string GetError() const; |
219 | 218 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 private: | 682 private: |
684 // If you're hitting a compile error here due to "final" - great! You're | 683 // If you're hitting a compile error here due to "final" - great! You're |
685 // doing the right thing, you just need to extend IOThreadExtensionFunction | 684 // doing the right thing, you just need to extend IOThreadExtensionFunction |
686 // instead of SyncIOExtensionFunction. | 685 // instead of SyncIOExtensionFunction. |
687 ResponseAction Run() final; | 686 ResponseAction Run() final; |
688 | 687 |
689 DISALLOW_COPY_AND_ASSIGN(SyncIOThreadExtensionFunction); | 688 DISALLOW_COPY_AND_ASSIGN(SyncIOThreadExtensionFunction); |
690 }; | 689 }; |
691 | 690 |
692 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 691 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
OLD | NEW |