OLD | NEW |
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) { |
(...skipping 29 matching lines...) Expand all Loading... |
40 static final Map<String, Resource> resources = new Map<String, Resource>(); | 40 static final Map<String, Resource> resources = new Map<String, Resource>(); |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 void _addResource(String name, List<int> data) { | 44 void _addResource(String name, List<int> data) { |
45 var mimeType = detectMimeType(name); | 45 var mimeType = detectMimeType(name); |
46 Resource resource = new Resource(name, mimeType, data); | 46 Resource resource = new Resource(name, mimeType, data); |
47 Resource.resources[name] = resource; | 47 Resource.resources[name] = resource; |
48 } | 48 } |
49 | 49 |
50 void _triggerResourceLoad() native "VMServiceIO_TriggerResourceLoad"; | 50 void _triggerResourceLoad() native "VMServiceIO_TriggerResourceLoad"; |
OLD | NEW |