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 <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 // The function has succeeded. | 88 // The function has succeeded. |
89 SUCCEEDED, | 89 SUCCEEDED, |
90 // The function has failed. | 90 // The function has failed. |
91 FAILED, | 91 FAILED, |
92 // The input message is malformed. | 92 // The input message is malformed. |
93 BAD_MESSAGE | 93 BAD_MESSAGE |
94 }; | 94 }; |
95 | 95 |
96 typedef base::Callback<void(ResponseType type, | 96 typedef base::Callback<void(ResponseType type, |
97 const base::ListValue& results, | 97 const base::ListValue& results, |
98 const std::string& error)> ResponseCallback; | 98 const std::string& error, |
99 const bool retain_user_gesture)> | |
100 ResponseCallback; | |
99 | 101 |
100 ExtensionFunction(); | 102 ExtensionFunction(); |
101 | 103 |
102 virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction(); | 104 virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction(); |
103 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); | 105 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); |
104 | 106 |
105 // Returns true if the function has permission to run. | 107 // Returns true if the function has permission to run. |
106 // | 108 // |
107 // The default implementation is to check the Extension's permissions against | 109 // The default implementation is to check the Extension's permissions against |
108 // what this function requires to run, but some APIs may require finer | 110 // what this function requires to run, but some APIs may require finer |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 177 |
176 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } | 178 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } |
177 bool has_callback() { return has_callback_; } | 179 bool has_callback() { return has_callback_; } |
178 | 180 |
179 void set_include_incognito(bool include) { include_incognito_ = include; } | 181 void set_include_incognito(bool include) { include_incognito_ = include; } |
180 bool include_incognito() const { return include_incognito_; } | 182 bool include_incognito() const { return include_incognito_; } |
181 | 183 |
182 void set_user_gesture(bool user_gesture) { user_gesture_ = user_gesture; } | 184 void set_user_gesture(bool user_gesture) { user_gesture_ = user_gesture; } |
183 bool user_gesture() const { return user_gesture_; } | 185 bool user_gesture() const { return user_gesture_; } |
184 | 186 |
187 void set_retain_user_gesture(bool retain_user_gesture) { | |
188 retain_user_gesture_ = retain_user_gesture; | |
189 } | |
190 bool retain_user_gesture() const { return retain_user_gesture_; } | |
191 | |
185 void set_histogram_value( | 192 void set_histogram_value( |
186 extensions::functions::HistogramValue histogram_value) { | 193 extensions::functions::HistogramValue histogram_value) { |
187 histogram_value_ = histogram_value; } | 194 histogram_value_ = histogram_value; } |
188 extensions::functions::HistogramValue histogram_value() const { | 195 extensions::functions::HistogramValue histogram_value() const { |
189 return histogram_value_; } | 196 return histogram_value_; } |
190 | 197 |
191 void set_response_callback(const ResponseCallback& callback) { | 198 void set_response_callback(const ResponseCallback& callback) { |
192 response_callback_ = callback; | 199 response_callback_ = callback; |
193 } | 200 } |
194 | 201 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 | 245 |
239 // True if this callback should include information from incognito contexts | 246 // True if this callback should include information from incognito contexts |
240 // even if our profile_ is non-incognito. Note that in the case of a "split" | 247 // even if our profile_ is non-incognito. Note that in the case of a "split" |
241 // mode extension, this will always be false, and we will limit access to | 248 // mode extension, this will always be false, and we will limit access to |
242 // data from within the same profile_ (either incognito or not). | 249 // data from within the same profile_ (either incognito or not). |
243 bool include_incognito_; | 250 bool include_incognito_; |
244 | 251 |
245 // True if the call was made in response of user gesture. | 252 // True if the call was made in response of user gesture. |
246 bool user_gesture_; | 253 bool user_gesture_; |
247 | 254 |
255 // True if the response callback should include a user gesture. | |
not at google - send to devlin
2014/04/09 16:44:32
True if the response callback should retain the |u
| |
256 bool retain_user_gesture_; | |
257 | |
248 // The arguments to the API. Only non-null if argument were specified. | 258 // The arguments to the API. Only non-null if argument were specified. |
249 scoped_ptr<base::ListValue> args_; | 259 scoped_ptr<base::ListValue> args_; |
250 | 260 |
251 // The results of the API. This should be populated by the derived class | 261 // The results of the API. This should be populated by the derived class |
252 // before SendResponse() is called. | 262 // before SendResponse() is called. |
253 scoped_ptr<base::ListValue> results_; | 263 scoped_ptr<base::ListValue> results_; |
254 | 264 |
255 // Any detailed error from the API. This should be populated by the derived | 265 // Any detailed error from the API. This should be populated by the derived |
256 // class before Run() returns. | 266 // class before Run() returns. |
257 std::string error_; | 267 std::string error_; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 public: | 456 public: |
447 SyncIOThreadExtensionFunction(); | 457 SyncIOThreadExtensionFunction(); |
448 | 458 |
449 virtual void Run() OVERRIDE; | 459 virtual void Run() OVERRIDE; |
450 | 460 |
451 protected: | 461 protected: |
452 virtual ~SyncIOThreadExtensionFunction(); | 462 virtual ~SyncIOThreadExtensionFunction(); |
453 }; | 463 }; |
454 | 464 |
455 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 465 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
OLD | NEW |