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

Side by Side Diff: samples/leap/request_cache.dart

Issue 10823352: Rename XMLHttpRequest to HttpRequest. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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('request_cache'); 5 #library('request_cache');
6 6
7 #import('dart:html'); 7 #import('dart:html');
8 8
9 /** File system implementation using HTML5's Web Storage. */ 9 /** File system implementation using HTML5's Web Storage. */
10 class HttpRequestCache { 10 class HttpRequestCache {
11 final Storage storage; 11 final Storage storage;
12 12
13 HttpRequestCache() : storage = window.sessionStorage; 13 HttpRequestCache() : storage = window.sessionStorage;
14 14
15 String readAll(String filename) { 15 String readAll(String filename) {
16 String response = storage[filename]; 16 String response = storage[filename];
17 17
18 if (response == null) { 18 if (response == null) {
19 XMLHttpRequest xr = new XMLHttpRequest(); 19 HttpRequest xr = new HttpRequest();
20 xr.open("GET", filename, false); 20 xr.open("GET", filename, false);
21 xr.send(); 21 xr.send();
22 response = xr.responseText; 22 response = xr.responseText;
23 storage[filename] = response; 23 storage[filename] = response;
24 } 24 }
25 return response; 25 return response;
26 } 26 }
27 } 27 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698