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 #include "extensions/browser/extension_function.h" | 5 #include "extensions/browser/extension_function.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 void ExtensionFunction::SetArgs(const base::ListValue* args) { | 266 void ExtensionFunction::SetArgs(const base::ListValue* args) { |
267 DCHECK(!args_.get()); // Should only be called once. | 267 DCHECK(!args_.get()); // Should only be called once. |
268 args_.reset(args->DeepCopy()); | 268 args_.reset(args->DeepCopy()); |
269 } | 269 } |
270 | 270 |
271 void ExtensionFunction::SetResult(base::Value* result) { | 271 void ExtensionFunction::SetResult(base::Value* result) { |
272 results_.reset(new base::ListValue()); | 272 results_.reset(new base::ListValue()); |
273 results_->Append(result); | 273 results_->Append(result); |
274 } | 274 } |
275 | 275 |
| 276 void ExtensionFunction::SetResult(scoped_ptr<base::Value> result) { |
| 277 results_.reset(new base::ListValue()); |
| 278 results_->Append(result.Pass()); |
| 279 } |
| 280 |
276 void ExtensionFunction::SetResultList(scoped_ptr<base::ListValue> results) { | 281 void ExtensionFunction::SetResultList(scoped_ptr<base::ListValue> results) { |
277 results_ = results.Pass(); | 282 results_ = results.Pass(); |
278 } | 283 } |
279 | 284 |
280 const base::ListValue* ExtensionFunction::GetResultList() const { | 285 const base::ListValue* ExtensionFunction::GetResultList() const { |
281 return results_.get(); | 286 return results_.get(); |
282 } | 287 } |
283 | 288 |
284 std::string ExtensionFunction::GetError() const { | 289 std::string ExtensionFunction::GetError() const { |
285 return error_; | 290 return error_; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 580 |
576 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 581 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
577 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 582 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
578 } | 583 } |
579 | 584 |
580 // static | 585 // static |
581 bool SyncIOThreadExtensionFunction::ValidationFailure( | 586 bool SyncIOThreadExtensionFunction::ValidationFailure( |
582 SyncIOThreadExtensionFunction* function) { | 587 SyncIOThreadExtensionFunction* function) { |
583 return false; | 588 return false; |
584 } | 589 } |
OLD | NEW |