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

Side by Side Diff: runtime/bin/vmservice/resources.dart

Issue 584293002: Begin implementing a debugger page in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 2 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
« no previous file with comments | « runtime/bin/vmservice/observatory/web/index_devtools.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of vmservice_io; 5 part of vmservice_io;
6 6
7 String detectMimeType(String name) { 7 String detectMimeType(String name) {
8 var extensionStart = name.lastIndexOf('.'); 8 var extensionStart = name.lastIndexOf('.');
9 var extension = name.substring(extensionStart+1); 9 var extension = name.substring(extensionStart+1);
10 switch (extension) { 10 switch (extension) {
11 case 'html': 11 case 'html':
12 return 'text/html; charset=UTF-8'; 12 return 'text/html; charset=UTF-8';
13 case 'dart': 13 case 'dart':
14 return 'application/dart; charset=UTF-8'; 14 return 'application/dart; charset=UTF-8';
15 case 'js': 15 case 'js':
16 return 'application/javascript; charset=UTF-8'; 16 return 'application/javascript; charset=UTF-8';
17 case 'css': 17 case 'css':
18 return 'text/css; charset=UTF-8'; 18 return 'text/css; charset=UTF-8';
19 case 'gif': 19 case 'gif':
20 return 'image/gif'; 20 return 'image/gif';
21 case 'png': 21 case 'png':
22 return 'image/png'; 22 return 'image/png';
23 case 'jpg': 23 case 'jpg':
24 return 'image/jpeg'; 24 return 'image/jpeg';
25 case 'jpeg': 25 case 'jpeg':
26 return 'image/jpeg'; 26 return 'image/jpeg';
27 case 'svg':
28 return 'image/svg+xml';
27 default: 29 default:
28 return 'text/plain'; 30 return 'text/plain';
29 } 31 }
30 } 32 }
31 33
32 34
33 class Resource { 35 class Resource {
34 final String name; 36 final String name;
35 final String mimeType; 37 final String mimeType;
36 final List<int> data; 38 final List<int> data;
37 Resource(this.name, this.mimeType, this.data); 39 Resource(this.name, this.mimeType, this.data);
38 static final Map<String, Resource> resources = new Map<String, Resource>(); 40 static final Map<String, Resource> resources = new Map<String, Resource>();
39 } 41 }
40 42
41 43
42 void _addResource(String name, List<int> data) { 44 void _addResource(String name, List<int> data) {
43 var mimeType = detectMimeType(name); 45 var mimeType = detectMimeType(name);
44 Resource resource = new Resource(name, mimeType, data); 46 Resource resource = new Resource(name, mimeType, data);
45 Resource.resources[name] = resource; 47 Resource.resources[name] = resource;
46 } 48 }
47 49
48 void _triggerResourceLoad() native "VMServiceIO_TriggerResourceLoad"; 50 void _triggerResourceLoad() native "VMServiceIO_TriggerResourceLoad";
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/web/index_devtools.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698