Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: content/browser/service_manager/service_manager_context.cc

Issue 2562393005: [Chromecast] Reference internal services manifest. (Closed)
Patch Set: Fix CastContentClient header Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "content/browser/gpu/gpu_process_host.h" 17 #include "content/browser/gpu/gpu_process_host.h"
18 #include "content/browser/service_manager/merge_dictionary.h" 18 #include "content/browser/service_manager/merge_dictionary.h"
19 #include "content/common/service_manager/service_manager_connection_impl.h" 19 #include "content/common/service_manager/service_manager_connection_impl.h"
20 #include "content/grit/content_resources.h" 20 #include "content/grit/content_resources.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/content_browser_client.h" 22 #include "content/public/browser/content_browser_client.h"
23 #include "content/public/browser/utility_process_host.h" 23 #include "content/public/browser/utility_process_host.h"
24 #include "content/public/browser/utility_process_host_client.h" 24 #include "content/public/browser/utility_process_host_client.h"
25 #include "content/public/common/connection_filter.h"
25 #include "content/public/common/content_client.h" 26 #include "content/public/common/content_client.h"
26 #include "content/public/common/service_manager_connection.h" 27 #include "content/public/common/service_manager_connection.h"
27 #include "content/public/common/service_names.mojom.h" 28 #include "content/public/common/service_names.mojom.h"
28 #include "mojo/edk/embedder/embedder.h" 29 #include "mojo/edk/embedder/embedder.h"
29 #include "services/catalog/catalog.h" 30 #include "services/catalog/catalog.h"
30 #include "services/catalog/manifest_provider.h" 31 #include "services/catalog/manifest_provider.h"
31 #include "services/catalog/public/interfaces/constants.mojom.h" 32 #include "services/catalog/public/interfaces/constants.mojom.h"
32 #include "services/catalog/store.h" 33 #include "services/catalog/store.h"
33 #include "services/file/public/interfaces/constants.mojom.h" 34 #include "services/file/public/interfaces/constants.mojom.h"
34 #include "services/service_manager/connect_params.h" 35 #include "services/service_manager/connect_params.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 std::move(request), 269 std::move(request),
269 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); 270 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
270 271
271 ContentBrowserClient::StaticServiceMap services; 272 ContentBrowserClient::StaticServiceMap services;
272 GetContentClient()->browser()->RegisterInProcessServices(&services); 273 GetContentClient()->browser()->RegisterInProcessServices(&services);
273 for (const auto& entry : services) { 274 for (const auto& entry : services) {
274 ServiceManagerConnection::GetForProcess()->AddEmbeddedService(entry.first, 275 ServiceManagerConnection::GetForProcess()->AddEmbeddedService(entry.first,
275 entry.second); 276 entry.second);
276 } 277 }
277 278
279 ContentBrowserClient::ConnectionFilterList connection_filter_list;
280 GetContentClient()->browser()->AddConnectionFilters(&connection_filter_list);
281 for (auto& filter : connection_filter_list) {
282 ServiceManagerConnection::GetForProcess()->AddConnectionFilter(
283 std::move(filter));
284 }
285
278 // This is safe to assign directly from any thread, because 286 // This is safe to assign directly from any thread, because
279 // ServiceManagerContext must be constructed before anyone can call 287 // ServiceManagerContext must be constructed before anyone can call
280 // GetConnectorForIOThread(). 288 // GetConnectorForIOThread().
281 g_io_thread_connector.Get() = 289 g_io_thread_connector.Get() =
282 ServiceManagerConnection::GetForProcess()->GetConnector()->Clone(); 290 ServiceManagerConnection::GetForProcess()->GetConnector()->Clone();
283 291
284 ServiceManagerConnection::GetForProcess()->Start(); 292 ServiceManagerConnection::GetForProcess()->Start();
285 293
286 ContentBrowserClient::OutOfProcessServiceMap sandboxed_services; 294 ContentBrowserClient::OutOfProcessServiceMap sandboxed_services;
287 GetContentClient() 295 GetContentClient()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 base::Bind(&DestroyConnectorOnIOThread)); 332 base::Bind(&DestroyConnectorOnIOThread));
325 } 333 }
326 334
327 // static 335 // static
328 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { 336 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() {
329 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
330 return g_io_thread_connector.Get().get(); 338 return g_io_thread_connector.Get().get();
331 } 339 }
332 340
333 } // namespace content 341 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698