OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 part of dart_controller_service_isolate; | 5 part of dart_controller_service_isolate; |
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 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 _addResource(String name, List<int> data) { | 44 _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 _triggerResourceLoad() native "ServiceIsolate_TriggerResourceLoad"; | 50 _triggerResourceLoad() native "ServiceIsolate_TriggerResourceLoad"; |
OLD | NEW |