Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: chrome/browser/extensions/extension_function.h

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 virtual void GetQuotaLimitHeuristics( 100 virtual void GetQuotaLimitHeuristics(
101 QuotaLimitHeuristics* heuristics) const {} 101 QuotaLimitHeuristics* heuristics) const {}
102 102
103 // Called when the quota limit has been exceeded. The default implementation 103 // Called when the quota limit has been exceeded. The default implementation
104 // returns an error. 104 // returns an error.
105 virtual void OnQuotaExceeded(); 105 virtual void OnQuotaExceeded();
106 106
107 // Specifies the raw arguments to the function, as a JSON value. 107 // Specifies the raw arguments to the function, as a JSON value.
108 virtual void SetArgs(const base::ListValue* args); 108 virtual void SetArgs(const base::ListValue* args);
109 109
110 // Retrieves the results of the function as a Value. 110 // Sets a single Value as the results of the function.
111 const base::Value* GetResultValue(); 111 void SetResult(base::Value* result);
112
113 // Retrieves the results of the function as a ListValue.
114 const base::ListValue* GetResultList();
112 115
113 // Retrieves any error string from the function. 116 // Retrieves any error string from the function.
114 virtual const std::string GetError(); 117 virtual const std::string GetError();
115 118
116 // Sets the function's error string. 119 // Sets the function's error string.
117 virtual void SetError(const std::string& error); 120 virtual void SetError(const std::string& error);
118 121
119 // Specifies the name of the function. 122 // Specifies the name of the function.
120 void set_name(const std::string& name) { name_ = name; } 123 void set_name(const std::string& name) { name_ = name; }
121 const std::string& name() const { return name_; } 124 const std::string& name() const { return name_; }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 public: 427 public:
425 SyncIOThreadExtensionFunction(); 428 SyncIOThreadExtensionFunction();
426 429
427 virtual void Run() OVERRIDE; 430 virtual void Run() OVERRIDE;
428 431
429 protected: 432 protected:
430 virtual ~SyncIOThreadExtensionFunction(); 433 virtual ~SyncIOThreadExtensionFunction();
431 }; 434 };
432 435
433 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ 436 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698