Chromium Code Reviews| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 virtual void GetQuotaLimitHeuristics( | 101 virtual void GetQuotaLimitHeuristics( |
| 102 QuotaLimitHeuristics* heuristics) const {} | 102 QuotaLimitHeuristics* heuristics) const {} |
| 103 | 103 |
| 104 // Called when the quota limit has been exceeded. The default implementation | 104 // Called when the quota limit has been exceeded. The default implementation |
| 105 // returns an error. | 105 // returns an error. |
| 106 virtual void OnQuotaExceeded(); | 106 virtual void OnQuotaExceeded(); |
| 107 | 107 |
| 108 // Specifies the raw arguments to the function, as a JSON value. | 108 // Specifies the raw arguments to the function, as a JSON value. |
| 109 virtual void SetArgs(const base::ListValue* args); | 109 virtual void SetArgs(const base::ListValue* args); |
| 110 | 110 |
| 111 // Retrieves the results of the function as a Value. | 111 // Sets a single Value as the results of the function. |
| 112 const base::Value* GetResultValue(); | 112 void SetSingleResult(base::Value* result); |
| 113 | |
| 114 // Retrieves the results of the function as a ListValue. | |
| 115 const base::ListValue* GetResultsListValue(); | |
|
Aaron Boodman
2012/07/09 04:39:31
Kinda weird to include ListValue in name of method
Matt Tytel
2012/07/10 18:50:45
Done.
| |
| 113 | 116 |
| 114 // Retrieves any error string from the function. | 117 // Retrieves any error string from the function. |
| 115 virtual const std::string GetError(); | 118 virtual const std::string GetError(); |
| 116 | 119 |
| 117 // Sets the function's error string. | 120 // Sets the function's error string. |
| 118 virtual void SetError(const std::string& error); | 121 virtual void SetError(const std::string& error); |
| 119 | 122 |
| 120 // Specifies the name of the function. | 123 // Specifies the name of the function. |
| 121 void set_name(const std::string& name) { name_ = name; } | 124 void set_name(const std::string& name) { name_ = name; } |
| 122 const std::string& name() const { return name_; } | 125 const std::string& name() const { return name_; } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 // mode extension, this will always be false, and we will limit access to | 203 // mode extension, this will always be false, and we will limit access to |
| 201 // data from within the same profile_ (either incognito or not). | 204 // data from within the same profile_ (either incognito or not). |
| 202 bool include_incognito_; | 205 bool include_incognito_; |
| 203 | 206 |
| 204 // True if the call was made in response of user gesture. | 207 // True if the call was made in response of user gesture. |
| 205 bool user_gesture_; | 208 bool user_gesture_; |
| 206 | 209 |
| 207 // The arguments to the API. Only non-null if argument were specified. | 210 // The arguments to the API. Only non-null if argument were specified. |
| 208 scoped_ptr<base::ListValue> args_; | 211 scoped_ptr<base::ListValue> args_; |
| 209 | 212 |
| 210 // The result of the API. This should be populated by the derived class before | 213 // The results of the API. This should be populated by the derived class |
| 211 // SendResponse() is called. | 214 // before SendResponse() is called. |
| 212 scoped_ptr<base::Value> result_; | 215 scoped_ptr<base::ListValue> results_; |
| 213 | 216 |
| 214 // Any detailed error from the API. This should be populated by the derived | 217 // Any detailed error from the API. This should be populated by the derived |
| 215 // class before Run() returns. | 218 // class before Run() returns. |
| 216 std::string error_; | 219 std::string error_; |
| 217 | 220 |
| 218 // Any class that gets a malformed message should set this to true before | 221 // Any class that gets a malformed message should set this to true before |
| 219 // returning. The calling renderer process will be killed. | 222 // returning. The calling renderer process will be killed. |
| 220 bool bad_message_; | 223 bool bad_message_; |
| 221 | 224 |
| 222 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); | 225 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 public: | 428 public: |
| 426 SyncIOThreadExtensionFunction(); | 429 SyncIOThreadExtensionFunction(); |
| 427 | 430 |
| 428 virtual void Run() OVERRIDE; | 431 virtual void Run() OVERRIDE; |
| 429 | 432 |
| 430 protected: | 433 protected: |
| 431 virtual ~SyncIOThreadExtensionFunction(); | 434 virtual ~SyncIOThreadExtensionFunction(); |
| 432 }; | 435 }; |
| 433 | 436 |
| 434 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 437 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| OLD | NEW |