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

Side by Side Diff: services/dart/test/echo.dart

Issue 816113004: Dart: Adds a content handler and a test. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 5 years, 11 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 | « services/dart/test/BUILD.gn ('k') | services/dart/test/echo_service.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!mojo mojo:dart_content_handler
2
3 // Copyright 2014 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
6
7 import 'dart:async';
8 import 'dart:mojo_application';
9 import 'dart:mojo_bindings';
10 import 'dart:mojo_core';
11
12 import 'package:services/dart/test/echo_service.mojom.dart';
13
14 // TODO(zra): Interface implementations that delegate to another implementation
15 // will all look the same, more or less. Maybe we should generate them?
16 class EchoServiceImpl extends EchoServiceInterface {
17 EchoServiceInterface _delegate;
18
19 EchoServiceImpl(this._delegate, MojoMessagePipeEndpoint endpoint) :
20 super(endpoint);
21
22 echoString(String value) => _delegate.echoString(value);
23 }
24
25 class EchoApplication extends Application implements EchoServiceInterface {
26 EchoApplication(MojoMessagePipeEndpoint endpoint) : super(endpoint);
27
28 EchoApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle);
29
30 Function interfaceFactoryClosure() {
31 return (endpoint) => new EchoServiceImpl(this, endpoint);
32 }
33
34 echoString(String value) {
35 var response = new EchoServiceEchoStringResponseParams();
36 if (value == 'quit') {
37 close();
38 }
39 response.value = value;
40 return new Future.value(response);
41 }
42 }
43
44 main(List args) {
45 MojoHandle shellHandle = new MojoHandle(args[0]);
46 String url = args[1];
47 var echoApplication = new EchoApplication.fromHandle(shellHandle);
48 echoApplication.listen();
49 }
OLDNEW
« no previous file with comments | « services/dart/test/BUILD.gn ('k') | services/dart/test/echo_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698