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

Side by Side Diff: lib/src/file_system/browser.dart

Issue 11471037: Updating dwc for breaking changes that will be part of the next sdk (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library browser; 5 library browser;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'path.dart'; 9 import 'path.dart';
10 import 'package:web_components/src/file_system.dart'; 10 import 'package:web_components/src/file_system.dart' as fs;
11 import 'package:js/js.dart' as js; 11 import 'package:js/js.dart' as js;
12 12
13 /** 13 /**
14 * File system implementation indirectly using the Chrome Extension Api's to 14 * File system implementation indirectly using the Chrome Extension Api's to
15 * proxy arbitrary urls. See extension/background.js for the code that does 15 * proxy arbitrary urls. See extension/background.js for the code that does
16 * the actual proxying. 16 * the actual proxying.
17 */ 17 */
18 class BrowserFileSystem implements FileSystem { 18 class BrowserFileSystem implements fs.FileSystem {
19 19
20 /** 20 /**
21 * Chrome extension port used to communicate back to the source page that 21 * Chrome extension port used to communicate back to the source page that
22 * will consume these proxied urls. 22 * will consume these proxied urls.
23 */ 23 */
24 js.Proxy sourcePagePort; 24 js.Proxy sourcePagePort;
25 25
26 final _filesToProxy = <String>{}; 26 final _filesToProxy = <String>{};
27 final _random = new Random(); 27 final _random = new Random();
28 final _uriScheme; 28 final _uriScheme;
(...skipping 27 matching lines...) Expand all
56 var completer = new Completer<String>(); 56 var completer = new Completer<String>();
57 // We must add a random id or a timestamp to defeat proxy servers and Chrome 57 // We must add a random id or a timestamp to defeat proxy servers and Chrome
58 // caching when accessing file urls. 58 // caching when accessing file urls.
59 var uniqueUrl = '$_uriScheme://$path?random_id=${_random.nextDouble()}'; 59 var uniqueUrl = '$_uriScheme://$path?random_id=${_random.nextDouble()}';
60 new HttpRequest.get(uniqueUrl, onSuccess(HttpRequest request) { 60 new HttpRequest.get(uniqueUrl, onSuccess(HttpRequest request) {
61 completer.complete(request.responseText); 61 completer.complete(request.responseText);
62 }); 62 });
63 return completer.future; 63 return completer.future;
64 } 64 }
65 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698