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

Unified Diff: sky/framework/net/fetch.dart

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/layouts/block.dart ('k') | sky/framework/node.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/net/fetch.dart
diff --git a/sky/framework/net/fetch.dart b/sky/framework/net/fetch.dart
deleted file mode 100644
index c2f231b33f7589a08c0f7ccf282497d27040f114..0000000000000000000000000000000000000000
--- a/sky/framework/net/fetch.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import '../shell.dart' as shell;
-import 'dart:async';
-import 'dart:sky' as sky;
-import 'dart:typed_data';
-import 'package:mojo/public/dart/core.dart' as core;
-import 'package:mojom/mojo/network_service.mojom.dart';
-import 'package:mojom/mojo/url_loader.mojom.dart';
-
-class Response {
- ByteData body;
-
- Response(this.body);
-
- String bodyAsString() {
- return new String.fromCharCodes(new Uint8List.view(body.buffer));
- }
-}
-
-Future<Response> fetch(String relativeUrl) async {
- String url = new sky.URL(relativeUrl, sky.document.baseURI).href;
-
- var net = new NetworkServiceProxy.unbound();
- shell.requestService("mojo:network_service", net);
-
- var loader = new UrlLoaderProxy.unbound();
- net.ptr.createUrlLoader(loader);
-
- var request = new UrlRequest()
- ..url = url
- ..autoFollowRedirects = true;
- var response = (await loader.ptr.start(request)).response;
-
- loader.close();
- net.close();
-
- if (response.body == null) return new Response(null);
-
- ByteData data = await core.DataPipeDrainer.drainHandle(response.body);
- return new Response(data);
-}
« no previous file with comments | « sky/framework/layouts/block.dart ('k') | sky/framework/node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698