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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 ResponseType type = success ? SUCCEEDED : FAILED; | 397 ResponseType type = success ? SUCCEEDED : FAILED; |
398 if (bad_message_) { | 398 if (bad_message_) { |
399 type = BAD_MESSAGE; | 399 type = BAD_MESSAGE; |
400 LOG(ERROR) << "Bad extension message " << name_; | 400 LOG(ERROR) << "Bad extension message " << name_; |
401 } | 401 } |
402 | 402 |
403 // If results were never set, we send an empty argument list. | 403 // If results were never set, we send an empty argument list. |
404 if (!results_) | 404 if (!results_) |
405 results_.reset(new base::ListValue()); | 405 results_.reset(new base::ListValue()); |
406 | 406 |
407 response_callback_.Run(type, *results_, GetError()); | 407 response_callback_.Run(type, *results_, GetError(), histogram_value()); |
408 } | 408 } |
409 | 409 |
410 void ExtensionFunction::OnRespondingLater(ResponseValue value) { | 410 void ExtensionFunction::OnRespondingLater(ResponseValue value) { |
411 SendResponse(value->Apply()); | 411 SendResponse(value->Apply()); |
412 } | 412 } |
413 | 413 |
414 UIThreadExtensionFunction::UIThreadExtensionFunction() | 414 UIThreadExtensionFunction::UIThreadExtensionFunction() |
415 : render_view_host_(NULL), | 415 : render_view_host_(NULL), |
416 render_frame_host_(NULL), | 416 render_frame_host_(NULL), |
417 context_(NULL), | 417 context_(NULL), |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 | 570 |
571 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 571 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
572 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 572 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
573 } | 573 } |
574 | 574 |
575 // static | 575 // static |
576 bool SyncIOThreadExtensionFunction::ValidationFailure( | 576 bool SyncIOThreadExtensionFunction::ValidationFailure( |
577 SyncIOThreadExtensionFunction* function) { | 577 SyncIOThreadExtensionFunction* function) { |
578 return false; | 578 return false; |
579 } | 579 } |
OLD | NEW |