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

Side by Side Diff: services/dart/content_handler_app_service_connector.cc

Issue 2010283006: Almost done: ApplicationDelegate -> ApplicationImplBase conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@work798-x-work797-x-work796_no_run_main_app
Patch Set: rebased Created 4 years, 6 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
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 "services/dart/content_handler_app_service_connector.h" 5 #include "services/dart/content_handler_app_service_connector.h"
6 6
7 #include "base/bind.h"
7 #include "base/location.h" 8 #include "base/location.h"
8 #include "mojo/public/cpp/application/connect.h" 9 #include "mojo/public/cpp/application/connect.h"
9 #include "mojo/public/cpp/bindings/interface_request.h" 10 #include "mojo/public/cpp/bindings/interface_request.h"
10 #include "mojo/services/files/interfaces/files.mojom.h" 11 #include "mojo/services/files/interfaces/files.mojom.h"
11 #include "mojo/services/network/interfaces/network_service.mojom.h" 12 #include "mojo/services/network/interfaces/network_service.mojom.h"
12 13
13 namespace dart { 14 namespace dart {
14 15
15 // This callback runs on the Dart content handler message loop thread. Bound 16 // This callback runs on the Dart content handler message loop thread. Bound
16 // to |this| by a weak pointer. 17 // to |this| by a weak pointer.
17 template<typename Interface> 18 template<typename Interface>
18 void ContentHandlerAppServiceConnector::Connect( 19 void ContentHandlerAppServiceConnector::Connect(
19 std::string application_name, 20 std::string application_name,
20 mojo::InterfaceRequest<Interface> interface_request) { 21 mojo::InterfaceRequest<Interface> interface_request) {
21 mojo::ConnectToService(content_handler_app_->shell(), application_name, 22 mojo::ConnectToService(shell_, application_name, interface_request.Pass());
22 interface_request.Pass());
23 } 23 }
24 24
25 ContentHandlerAppServiceConnector::ContentHandlerAppServiceConnector( 25 ContentHandlerAppServiceConnector::ContentHandlerAppServiceConnector(
26 mojo::ApplicationImpl* content_handler_app) 26 mojo::Shell* shell)
27 : runner_(base::MessageLoop::current()->task_runner()), 27 : runner_(base::MessageLoop::current()->task_runner()),
28 content_handler_app_(content_handler_app), 28 shell_(shell),
29 weak_ptr_factory_(this) { 29 weak_ptr_factory_(this) {
30 CHECK(content_handler_app != nullptr); 30 CHECK(shell != nullptr);
31 CHECK(runner_.get() != nullptr); 31 CHECK(runner_.get() != nullptr);
32 CHECK(runner_.get()->BelongsToCurrentThread()); 32 CHECK(runner_.get()->BelongsToCurrentThread());
33 } 33 }
34 34
35 ContentHandlerAppServiceConnector::~ContentHandlerAppServiceConnector() { 35 ContentHandlerAppServiceConnector::~ContentHandlerAppServiceConnector() {
36 } 36 }
37 37
38 MojoHandle ContentHandlerAppServiceConnector::ConnectToService( 38 MojoHandle ContentHandlerAppServiceConnector::ConnectToService(
39 ServiceId service_id) { 39 ServiceId service_id) {
40 switch (service_id) { 40 switch (service_id) {
(...skipping 21 matching lines...) Expand all
62 return interface_ptr.PassInterfaceHandle().PassHandle().release().value(); 62 return interface_ptr.PassInterfaceHandle().PassHandle().release().value();
63 } 63 }
64 break; 64 break;
65 default: 65 default:
66 return MOJO_HANDLE_INVALID; 66 return MOJO_HANDLE_INVALID;
67 break; 67 break;
68 } 68 }
69 } 69 }
70 70
71 } // namespace dart 71 } // namespace dart
OLDNEW
« no previous file with comments | « services/dart/content_handler_app_service_connector.h ('k') | services/dart/content_handler_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698