OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/service_manager/service_manager_context.h" | 5 #include "content/browser/service_manager/service_manager_context.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 { kRendererServiceName, IDR_MOJO_CONTENT_RENDERER_MANIFEST }, | 218 { kRendererServiceName, IDR_MOJO_CONTENT_RENDERER_MANIFEST }, |
219 { kUtilityServiceName, IDR_MOJO_CONTENT_UTILITY_MANIFEST }, | 219 { kUtilityServiceName, IDR_MOJO_CONTENT_UTILITY_MANIFEST }, |
220 { "service:catalog", IDR_MOJO_CATALOG_MANIFEST }, | 220 { "service:catalog", IDR_MOJO_CATALOG_MANIFEST }, |
221 { file::kFileServiceName, IDR_MOJO_FILE_MANIFEST } | 221 { file::kFileServiceName, IDR_MOJO_FILE_MANIFEST } |
222 }; | 222 }; |
223 | 223 |
224 for (size_t i = 0; i < arraysize(kManifests); ++i) { | 224 for (size_t i = 0; i < arraysize(kManifests); ++i) { |
225 std::string contents = GetContentClient()->GetDataResource( | 225 std::string contents = GetContentClient()->GetDataResource( |
226 kManifests[i].resource_id, | 226 kManifests[i].resource_id, |
227 ui::ScaleFactor::SCALE_FACTOR_NONE).as_string(); | 227 ui::ScaleFactor::SCALE_FACTOR_NONE).as_string(); |
228 DCHECK(!contents.empty()); | 228 base::debug::Alias(&i); |
| 229 CHECK(!contents.empty()); |
| 230 |
229 std::unique_ptr<base::Value> manifest_value = | 231 std::unique_ptr<base::Value> manifest_value = |
230 base::JSONReader::Read(contents); | 232 base::JSONReader::Read(contents); |
| 233 base::debug::Alias(&contents); |
| 234 CHECK(manifest_value); |
| 235 |
231 std::unique_ptr<base::Value> overlay_value = | 236 std::unique_ptr<base::Value> overlay_value = |
232 GetContentClient()->browser()->GetServiceManifestOverlay( | 237 GetContentClient()->browser()->GetServiceManifestOverlay( |
233 kManifests[i].name); | 238 kManifests[i].name); |
234 if (overlay_value) { | 239 if (overlay_value) { |
235 base::DictionaryValue* manifest_dictionary = nullptr; | 240 base::DictionaryValue* manifest_dictionary = nullptr; |
236 CHECK(manifest_value->GetAsDictionary(&manifest_dictionary)); | 241 CHECK(manifest_value->GetAsDictionary(&manifest_dictionary)); |
237 base::DictionaryValue* overlay_dictionary = nullptr; | 242 base::DictionaryValue* overlay_dictionary = nullptr; |
238 CHECK(overlay_value->GetAsDictionary(&overlay_dictionary)); | 243 CHECK(overlay_value->GetAsDictionary(&overlay_dictionary)); |
239 MergeDictionary(manifest_dictionary, overlay_dictionary); | 244 MergeDictionary(manifest_dictionary, overlay_dictionary); |
240 } | 245 } |
| 246 |
241 manifest_provider->AddManifestValue(kManifests[i].name, | 247 manifest_provider->AddManifestValue(kManifests[i].name, |
242 std::move(manifest_value)); | 248 std::move(manifest_value)); |
243 } | 249 } |
244 in_process_context_ = new InProcessServiceManagerContext; | 250 in_process_context_ = new InProcessServiceManagerContext; |
245 request = in_process_context_->Start(std::move(manifest_provider)); | 251 request = in_process_context_->Start(std::move(manifest_provider)); |
246 } | 252 } |
247 ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( | 253 ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( |
248 std::move(request), | 254 std::move(request), |
249 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); | 255 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); |
250 | 256 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 base::Bind(&DestroyConnectorOnIOThread)); | 310 base::Bind(&DestroyConnectorOnIOThread)); |
305 } | 311 } |
306 | 312 |
307 // static | 313 // static |
308 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { | 314 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { |
309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
310 return g_io_thread_connector.Get().get(); | 316 return g_io_thread_connector.Get().get(); |
311 } | 317 } |
312 | 318 |
313 } // namespace content | 319 } // namespace content |
OLD | NEW |