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 import '../shell.dart' as shell; | 5 import '../shell.dart' as shell; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:mojo.core' as core; | |
8 import 'dart:sky' as sky; | 7 import 'dart:sky' as sky; |
9 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
| 9 import 'package:mojo/public/dart/core.dart' as core; |
10 import 'package:mojo/services/network/public/interfaces/network_service.mojom.da
rt'; | 10 import 'package:mojo/services/network/public/interfaces/network_service.mojom.da
rt'; |
11 import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart'; | 11 import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart'; |
12 | 12 |
13 class Response { | 13 class Response { |
14 ByteData body; | 14 ByteData body; |
15 | 15 |
16 Response(this.body); | 16 Response(this.body); |
17 | 17 |
18 String bodyAsString() { | 18 String bodyAsString() { |
19 return new String.fromCharCodes(new Uint8List.view(body.buffer)); | 19 return new String.fromCharCodes(new Uint8List.view(body.buffer)); |
(...skipping 16 matching lines...) Expand all Loading... |
36 | 36 |
37 loader.close(); | 37 loader.close(); |
38 net.close(); | 38 net.close(); |
39 | 39 |
40 if (response.body == null) | 40 if (response.body == null) |
41 return new Response(null); | 41 return new Response(null); |
42 | 42 |
43 ByteData data = await core.DataPipeDrainer.drainHandle(response.body); | 43 ByteData data = await core.DataPipeDrainer.drainHandle(response.body); |
44 return new Response(data); | 44 return new Response(data); |
45 } | 45 } |
OLD | NEW |