OLD | NEW |
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_ui/src/file_system.dart'; |
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 FileSystem { |
19 | 19 |
20 /** | 20 /** |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |