Chromium Code Reviews| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 base::DictionaryValue* manifest_dictionary = nullptr; | 241 base::DictionaryValue* manifest_dictionary = nullptr; |
| 242 CHECK(manifest_value->GetAsDictionary(&manifest_dictionary)); | 242 CHECK(manifest_value->GetAsDictionary(&manifest_dictionary)); |
| 243 base::DictionaryValue* overlay_dictionary = nullptr; | 243 base::DictionaryValue* overlay_dictionary = nullptr; |
| 244 CHECK(overlay_value->GetAsDictionary(&overlay_dictionary)); | 244 CHECK(overlay_value->GetAsDictionary(&overlay_dictionary)); |
| 245 MergeDictionary(manifest_dictionary, overlay_dictionary); | 245 MergeDictionary(manifest_dictionary, overlay_dictionary); |
| 246 } | 246 } |
| 247 | 247 |
| 248 manifest_provider->AddManifestValue(kManifests[i].name, | 248 manifest_provider->AddManifestValue(kManifests[i].name, |
| 249 std::move(manifest_value)); | 249 std::move(manifest_value)); |
| 250 } | 250 } |
| 251 for (const auto& manifest : | |
| 252 GetContentClient()->browser()->GetExtraServiceManifests()) { | |
| 253 std::string contents = | |
| 254 GetContentClient() | |
| 255 ->GetDataResource(manifest.second, | |
| 256 ui::ScaleFactor::SCALE_FACTOR_NONE) | |
| 257 .as_string(); | |
| 258 base::debug::Alias(&manifest.first); | |
|
piman
2016/11/23 18:08:10
Why this?
Sam McNally
2016/11/24 02:10:41
Copy-pasta. Removed it.
| |
| 259 CHECK(!contents.empty()); | |
|
piman
2016/11/23 18:08:11
nit: DCHECK
Sam McNally
2016/11/24 02:10:41
I've refactored this duplicate code out, keeping t
| |
| 260 | |
| 261 std::unique_ptr<base::Value> manifest_value = | |
| 262 base::JSONReader::Read(contents); | |
| 263 base::debug::Alias(&contents); | |
|
piman
2016/11/23 18:08:11
Why this?
Sam McNally
2016/11/24 02:10:41
Copy-pasta.
| |
| 264 CHECK(manifest_value); | |
|
piman
2016/11/23 18:08:11
nit: DCHECK
Sam McNally
2016/11/24 02:10:41
Same as with the above CHECK.
| |
| 265 | |
| 266 manifest_provider->AddManifestValue(manifest.first, | |
| 267 std::move(manifest_value)); | |
|
piman
2016/11/23 18:08:11
This block looks like a bunch of copy/paste from t
Sam McNally
2016/11/24 02:10:41
Done.
| |
| 268 } | |
| 251 in_process_context_ = new InProcessServiceManagerContext; | 269 in_process_context_ = new InProcessServiceManagerContext; |
| 252 request = in_process_context_->Start(std::move(manifest_provider)); | 270 request = in_process_context_->Start(std::move(manifest_provider)); |
| 253 } | 271 } |
| 254 ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( | 272 ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( |
| 255 std::move(request), | 273 std::move(request), |
| 256 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); | 274 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); |
| 257 | 275 |
| 258 ContentBrowserClient::StaticServiceMap services; | 276 ContentBrowserClient::StaticServiceMap services; |
| 259 GetContentClient()->browser()->RegisterInProcessServices(&services); | 277 GetContentClient()->browser()->RegisterInProcessServices(&services); |
| 260 for (const auto& entry : services) { | 278 for (const auto& entry : services) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 base::Bind(&DestroyConnectorOnIOThread)); | 329 base::Bind(&DestroyConnectorOnIOThread)); |
| 312 } | 330 } |
| 313 | 331 |
| 314 // static | 332 // static |
| 315 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { | 333 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { |
| 316 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 317 return g_io_thread_connector.Get().get(); | 335 return g_io_thread_connector.Get().get(); |
| 318 } | 336 } |
| 319 | 337 |
| 320 } // namespace content | 338 } // namespace content |
| OLD | NEW |