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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 2420253002: Rename shell namespace to service_manager (Closed)
Patch Set: . Created 4 years, 2 months 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
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/service_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); 256 mojo::edk::SetParentPipeHandle(std::move(platform_channel));
257 } 257 }
258 258
259 class ChannelBootstrapFilter : public ConnectionFilter { 259 class ChannelBootstrapFilter : public ConnectionFilter {
260 public: 260 public:
261 explicit ChannelBootstrapFilter(IPC::mojom::ChannelBootstrapPtrInfo bootstrap) 261 explicit ChannelBootstrapFilter(IPC::mojom::ChannelBootstrapPtrInfo bootstrap)
262 : bootstrap_(std::move(bootstrap)), weak_factory_(this) {} 262 : bootstrap_(std::move(bootstrap)), weak_factory_(this) {}
263 263
264 private: 264 private:
265 // ConnectionFilter: 265 // ConnectionFilter:
266 bool OnConnect(const shell::Identity& remote_identity, 266 bool OnConnect(const service_manager::Identity& remote_identity,
267 shell::InterfaceRegistry* registry, 267 service_manager::InterfaceRegistry* registry,
268 shell::Connector* connector) override { 268 service_manager::Connector* connector) override {
269 if (remote_identity.name() != kBrowserServiceName) 269 if (remote_identity.name() != kBrowserServiceName)
270 return false; 270 return false;
271 271
272 registry->AddInterface(base::Bind(&ChannelBootstrapFilter::CreateBootstrap, 272 registry->AddInterface(base::Bind(&ChannelBootstrapFilter::CreateBootstrap,
273 weak_factory_.GetWeakPtr())); 273 weak_factory_.GetWeakPtr()));
274 return true; 274 return true;
275 } 275 }
276 276
277 void CreateBootstrap(IPC::mojom::ChannelBootstrapRequest request) { 277 void CreateBootstrap(IPC::mojom::ChannelBootstrapRequest request) {
278 DCHECK(bootstrap_.is_valid()); 278 DCHECK(bootstrap_.is_valid());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 445 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
446 switches::kServiceRequestChannelToken); 446 switches::kServiceRequestChannelToken);
447 } else { 447 } else {
448 service_request_token = options.in_process_service_request_token; 448 service_request_token = options.in_process_service_request_token;
449 } 449 }
450 if (!service_request_token.empty()) { 450 if (!service_request_token.empty()) {
451 mojo::ScopedMessagePipeHandle handle = 451 mojo::ScopedMessagePipeHandle handle =
452 mojo::edk::CreateChildMessagePipe(service_request_token); 452 mojo::edk::CreateChildMessagePipe(service_request_token);
453 DCHECK(handle.is_valid()); 453 DCHECK(handle.is_valid());
454 service_manager_connection_ = ServiceManagerConnection::Create( 454 service_manager_connection_ = ServiceManagerConnection::Create(
455 mojo::MakeRequest<shell::mojom::Service>(std::move(handle)), 455 mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)),
456 GetIOTaskRunner()); 456 GetIOTaskRunner());
457 457
458 // When connect_to_browser is true, we obtain interfaces from the browser 458 // When connect_to_browser is true, we obtain interfaces from the browser
459 // process by connecting to it, rather than from the incoming interface 459 // process by connecting to it, rather than from the incoming interface
460 // provider. Exposed interfaces are subject to manifest capability spec. 460 // provider. Exposed interfaces are subject to manifest capability spec.
461 shell::InterfaceProvider* remote_interfaces = nullptr; 461 service_manager::InterfaceProvider* remote_interfaces = nullptr;
462 if (options.connect_to_browser) { 462 if (options.connect_to_browser) {
463 browser_connection_ = 463 browser_connection_ =
464 service_manager_connection_->GetConnector()->Connect( 464 service_manager_connection_->GetConnector()->Connect(
465 kBrowserServiceName); 465 kBrowserServiceName);
466 } else { 466 } else {
467 remote_interfaces = GetRemoteInterfaces(); 467 remote_interfaces = GetRemoteInterfaces();
468 } 468 }
469 469
470 // TODO(rockot): Remove this once all child-to-browser interface connections 470 // TODO(rockot): Remove this once all child-to-browser interface connections
471 // are made via a Connector rather than directly through an 471 // are made via a Connector rather than directly through an
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 648 }
649 649
650 void ChildThreadImpl::RecordComputedAction(const std::string& action) { 650 void ChildThreadImpl::RecordComputedAction(const std::string& action) {
651 NOTREACHED(); 651 NOTREACHED();
652 } 652 }
653 653
654 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { 654 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() {
655 return service_manager_connection_.get(); 655 return service_manager_connection_.get();
656 } 656 }
657 657
658 shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() { 658 service_manager::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() {
659 if (!interface_registry_.get()) 659 if (!interface_registry_.get())
660 interface_registry_.reset(new shell::InterfaceRegistry); 660 interface_registry_.reset(new service_manager::InterfaceRegistry);
661 return interface_registry_.get(); 661 return interface_registry_.get();
662 } 662 }
663 663
664 shell::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() { 664 service_manager::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
665 if (browser_connection_) 665 if (browser_connection_)
666 return browser_connection_->GetRemoteInterfaces(); 666 return browser_connection_->GetRemoteInterfaces();
667 667
668 if (!remote_interfaces_.get()) 668 if (!remote_interfaces_.get())
669 remote_interfaces_.reset(new shell::InterfaceProvider); 669 remote_interfaces_.reset(new service_manager::InterfaceProvider);
670 return remote_interfaces_.get(); 670 return remote_interfaces_.get();
671 } 671 }
672 672
673 IPC::MessageRouter* ChildThreadImpl::GetRouter() { 673 IPC::MessageRouter* ChildThreadImpl::GetRouter() {
674 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); 674 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
675 return &router_; 675 return &router_;
676 } 676 }
677 677
678 mojom::RouteProvider* ChildThreadImpl::GetRemoteRouteProvider() { 678 mojom::RouteProvider* ChildThreadImpl::GetRemoteRouteProvider() {
679 if (!remote_route_provider_) { 679 if (!remote_route_provider_) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 Listener* route = router_.GetRoute(routing_id); 864 Listener* route = router_.GetRoute(routing_id);
865 if (route) 865 if (route)
866 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); 866 route->OnAssociatedInterfaceRequest(name, request.PassHandle());
867 } 867 }
868 868
869 bool ChildThreadImpl::IsInBrowserProcess() const { 869 bool ChildThreadImpl::IsInBrowserProcess() const {
870 return static_cast<bool>(browser_process_io_runner_); 870 return static_cast<bool>(browser_process_io_runner_);
871 } 871 }
872 872
873 } // namespace content 873 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698