| 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/utility/utility_handler.h" | 5 #include "extensions/utility/utility_handler.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "content/public/utility/utility_thread.h" | 9 #include "content/public/utility/utility_thread.h" |
| 10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
| 11 #include "extensions/common/extension_l10n_util.h" | 11 #include "extensions/common/extension_l10n_util.h" |
| 12 #include "extensions/common/extension_unpacker.mojom.h" | 12 #include "extensions/common/extension_unpacker.mojom.h" |
| 13 #include "extensions/common/extensions_client.h" | 13 #include "extensions/common/extensions_client.h" |
| 14 #include "extensions/common/manifest.h" | 14 #include "extensions/common/manifest.h" |
| 15 #include "extensions/common/manifest_parser.mojom.h" | 15 #include "extensions/common/manifest_parser.mojom.h" |
| 16 #include "extensions/common/update_manifest.h" | 16 #include "extensions/common/update_manifest.h" |
| 17 #include "extensions/strings/grit/extensions_strings.h" | 17 #include "extensions/strings/grit/extensions_strings.h" |
| 18 #include "extensions/utility/unpacker.h" | 18 #include "extensions/utility/unpacker.h" |
| 19 #include "mojo/public/cpp/bindings/strong_binding.h" | 19 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 20 #include "services/service_manager/public/cpp/interface_registry.h" | 20 #include "services/service_manager/public/cpp/binder_registry.h" |
| 21 #include "third_party/zlib/google/zip.h" | 21 #include "third_party/zlib/google/zip.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/ui_base_switches.h" | 23 #include "ui/base/ui_base_switches.h" |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 class ExtensionUnpackerImpl : public extensions::mojom::ExtensionUnpacker { | 29 class ExtensionUnpackerImpl : public extensions::mojom::ExtensionUnpacker { |
| 30 public: | 30 public: |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 namespace utility_handler { | 128 namespace utility_handler { |
| 129 | 129 |
| 130 void UtilityThreadStarted() { | 130 void UtilityThreadStarted() { |
| 131 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 131 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 132 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); | 132 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); |
| 133 if (!lang.empty()) | 133 if (!lang.empty()) |
| 134 extension_l10n_util::SetProcessLocale(lang); | 134 extension_l10n_util::SetProcessLocale(lang); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ExposeInterfacesToBrowser(service_manager::InterfaceRegistry* registry, | 137 void ExposeInterfacesToBrowser(service_manager::BinderRegistry* registry, |
| 138 bool running_elevated) { | 138 bool running_elevated) { |
| 139 // If our process runs with elevated privileges, only add elevated Mojo | 139 // If our process runs with elevated privileges, only add elevated Mojo |
| 140 // interfaces to the interface registry. | 140 // interfaces to the interface registry. |
| 141 if (running_elevated) | 141 if (running_elevated) |
| 142 return; | 142 return; |
| 143 | 143 |
| 144 registry->AddInterface(base::Bind(&ExtensionUnpackerImpl::Create)); | 144 registry->AddInterface(base::Bind(&ExtensionUnpackerImpl::Create), |
| 145 registry->AddInterface(base::Bind(&ManifestParserImpl::Create)); | 145 base::ThreadTaskRunnerHandle::Get()); |
| 146 registry->AddInterface(base::Bind(&ManifestParserImpl::Create), |
| 147 base::ThreadTaskRunnerHandle::Get()); |
| 146 } | 148 } |
| 147 | 149 |
| 148 } // namespace utility_handler | 150 } // namespace utility_handler |
| 149 | 151 |
| 150 } // namespace extensions | 152 } // namespace extensions |
| OLD | NEW |