| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_dispatcher.h" | 5 #include "extensions/browser/extension_function_dispatcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 extensions::kInvalidServiceWorkerVersionId; | 69 extensions::kInvalidServiceWorkerVersionId; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Separate copy of ExtensionAPI used for IO thread extension functions. We need | 72 // Separate copy of ExtensionAPI used for IO thread extension functions. We need |
| 73 // this because ExtensionAPI has mutable data. It should be possible to remove | 73 // this because ExtensionAPI has mutable data. It should be possible to remove |
| 74 // this once all the extension APIs are updated to the feature system. | 74 // this once all the extension APIs are updated to the feature system. |
| 75 struct Static { | 75 struct Static { |
| 76 Static() : api(ExtensionAPI::CreateWithDefaultConfiguration()) {} | 76 Static() : api(ExtensionAPI::CreateWithDefaultConfiguration()) {} |
| 77 std::unique_ptr<ExtensionAPI> api; | 77 std::unique_ptr<ExtensionAPI> api; |
| 78 }; | 78 }; |
| 79 base::LazyInstance<Static> g_global_io_data = LAZY_INSTANCE_INITIALIZER; | 79 base::LazyInstance<Static>::DestructorAtExit g_global_io_data = |
| 80 LAZY_INSTANCE_INITIALIZER; |
| 80 | 81 |
| 81 void CommonResponseCallback(IPC::Sender* ipc_sender, | 82 void CommonResponseCallback(IPC::Sender* ipc_sender, |
| 82 int routing_id, | 83 int routing_id, |
| 83 int request_id, | 84 int request_id, |
| 84 ExtensionFunction::ResponseType type, | 85 ExtensionFunction::ResponseType type, |
| 85 const base::ListValue& results, | 86 const base::ListValue& results, |
| 86 const std::string& error) { | 87 const std::string& error) { |
| 87 DCHECK(ipc_sender); | 88 DCHECK(ipc_sender); |
| 88 | 89 |
| 89 if (type == ExtensionFunction::BAD_MESSAGE) { | 90 if (type == ExtensionFunction::BAD_MESSAGE) { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 // static | 606 // static |
| 606 void ExtensionFunctionDispatcher::SendAccessDenied( | 607 void ExtensionFunctionDispatcher::SendAccessDenied( |
| 607 const ExtensionFunction::ResponseCallback& callback, | 608 const ExtensionFunction::ResponseCallback& callback, |
| 608 functions::HistogramValue histogram_value) { | 609 functions::HistogramValue histogram_value) { |
| 609 base::ListValue empty_list; | 610 base::ListValue empty_list; |
| 610 callback.Run(ExtensionFunction::FAILED, empty_list, | 611 callback.Run(ExtensionFunction::FAILED, empty_list, |
| 611 "Access to extension API denied.", histogram_value); | 612 "Access to extension API denied.", histogram_value); |
| 612 } | 613 } |
| 613 | 614 |
| 614 } // namespace extensions | 615 } // namespace extensions |
| OLD | NEW |