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

Unified Diff: lib/src/browser/resource.dart

Issue 1612003002: Add browser-compatible version. (Closed) Base URL: https://github.com/dart-lang/resource.git@master
Patch Set: Made test run Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/browser/loader.dart ('k') | lib/src/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/browser/resource.dart
diff --git a/lib/src/browser/resource.dart b/lib/src/browser/resource.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9368e4e879572c12a82a9a5871adba564c15c61d
--- /dev/null
+++ b/lib/src/browser/resource.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:core" hide Resource;
+
+import "loader.dart" show ResourceLoader, DefaultLoader;
+
+// TODO(lrn): Merge with implementation when configured imports removes
+// the need to share code.
+import "../resource.dart" as base show Resource;
+
+class Resource extends base.Resource {
+ /// Creates a resource object with the given [uri] as location.
+ ///
+ /// The [uri] must be either a [Uri] or a string containing a valid URI.
+ /// If the string is not a valid URI, using any of the functions on
+ /// the resource object will fail.
+ ///
+ /// The URI may be relative, in which case it will be resolved
+ /// against [Uri.base] before being used.
+ ///
+ /// The URI may use the `package` scheme, which is always supported.
+ /// Other schemes may also be supported where possible.
+ ///
+ /// If [loader] is provided, it is used to load absolute non-package URIs.
+ /// Package: URIs are resolved to a non-package URI before being loaded, so
+ /// the loader doesn't have to support package: URIs, nor does it need to
+ /// support relative URI references.
+ /// If [loader] is omitted, a default implementation is used which supports
+ /// as many of `http`, `https`, `file` and `data` as are available on the
+ /// current platform.
+ const Resource(uri, {ResourceLoader loader})
+ : super(uri, (loader != null) ? loader : const DefaultLoader());
+}
« no previous file with comments | « lib/src/browser/loader.dart ('k') | lib/src/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698