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); |
Matt Perry
2012/07/09 23:52:25
IMO, Single is redundant here given that Result is
Matt Tytel
2012/07/10 18:50:45
Done.
Aaron Boodman
2012/07/10 20:34:22
Can you change the GetResults->GetResultList? Havi
Matt Tytel
2012/07/10 20:54:28
Done.
| |
113 | |
114 // Retrieves the results of the function as a ListValue. | |
115 const base::ListValue* GetResults(); | |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 // mode extension, this will always be false, and we will limit access to | 202 // mode extension, this will always be false, and we will limit access to |
200 // data from within the same profile_ (either incognito or not). | 203 // data from within the same profile_ (either incognito or not). |
201 bool include_incognito_; | 204 bool include_incognito_; |
202 | 205 |
203 // True if the call was made in response of user gesture. | 206 // True if the call was made in response of user gesture. |
204 bool user_gesture_; | 207 bool user_gesture_; |
205 | 208 |
206 // The arguments to the API. Only non-null if argument were specified. | 209 // The arguments to the API. Only non-null if argument were specified. |
207 scoped_ptr<base::ListValue> args_; | 210 scoped_ptr<base::ListValue> args_; |
208 | 211 |
209 // The result of the API. This should be populated by the derived class before | 212 // The results of the API. This should be populated by the derived class |
210 // SendResponse() is called. | 213 // before SendResponse() is called. |
211 scoped_ptr<base::Value> result_; | 214 scoped_ptr<base::ListValue> results_; |
212 | 215 |
213 // Any detailed error from the API. This should be populated by the derived | 216 // Any detailed error from the API. This should be populated by the derived |
214 // class before Run() returns. | 217 // class before Run() returns. |
215 std::string error_; | 218 std::string error_; |
216 | 219 |
217 // Any class that gets a malformed message should set this to true before | 220 // Any class that gets a malformed message should set this to true before |
218 // returning. The calling renderer process will be killed. | 221 // returning. The calling renderer process will be killed. |
219 bool bad_message_; | 222 bool bad_message_; |
220 | 223 |
221 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); | 224 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 public: | 423 public: |
421 SyncIOThreadExtensionFunction(); | 424 SyncIOThreadExtensionFunction(); |
422 | 425 |
423 virtual void Run() OVERRIDE; | 426 virtual void Run() OVERRIDE; |
424 | 427 |
425 protected: | 428 protected: |
426 virtual ~SyncIOThreadExtensionFunction(); | 429 virtual ~SyncIOThreadExtensionFunction(); |
427 }; | 430 }; |
428 | 431 |
429 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 432 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |