filesystemimpl.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2013 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview Concrete implementation of the goog.fs.FileSystem interface
  16. * using an HTML FileSystem object.
  17. */
  18. goog.provide('goog.fs.FileSystemImpl');
  19. goog.require('goog.fs.DirectoryEntryImpl');
  20. goog.require('goog.fs.FileSystem');
  21. /**
  22. * A local filesystem.
  23. *
  24. * This shouldn't be instantiated directly. Instead, it should be accessed via
  25. * {@link goog.fs.getTemporary} or {@link goog.fs.getPersistent}.
  26. *
  27. * @param {!FileSystem} fs The underlying FileSystem object.
  28. * @constructor
  29. * @implements {goog.fs.FileSystem}
  30. * @final
  31. */
  32. goog.fs.FileSystemImpl = function(fs) {
  33. /**
  34. * The underlying FileSystem object.
  35. *
  36. * @type {!FileSystem}
  37. * @private
  38. */
  39. this.fs_ = fs;
  40. };
  41. /** @override */
  42. goog.fs.FileSystemImpl.prototype.getName = function() {
  43. return this.fs_.name;
  44. };
  45. /** @override */
  46. goog.fs.FileSystemImpl.prototype.getRoot = function() {
  47. return new goog.fs.DirectoryEntryImpl(this, this.fs_.root);
  48. };
  49. /**
  50. * @return {!FileSystem} The underlying FileSystem object.
  51. */
  52. goog.fs.FileSystemImpl.prototype.getBrowserFileSystem = function() {
  53. return this.fs_;
  54. };