michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/dom/FileSystemBase.h" michael@0: michael@0: #include "DeviceStorageFileSystem.h" michael@0: #include "nsCharSeparatedTokenizer.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: // static michael@0: already_AddRefed michael@0: FileSystemBase::FromString(const nsAString& aString) michael@0: { michael@0: if (StringBeginsWith(aString, NS_LITERAL_STRING("devicestorage-"))) { michael@0: // The string representation of devicestorage file system is of the format: michael@0: // devicestorage-StorageType-StorageName michael@0: michael@0: nsCharSeparatedTokenizer tokenizer(aString, char16_t('-')); michael@0: tokenizer.nextToken(); michael@0: michael@0: nsString storageType; michael@0: if (tokenizer.hasMoreTokens()) { michael@0: storageType = tokenizer.nextToken(); michael@0: } michael@0: michael@0: nsString storageName; michael@0: if (tokenizer.hasMoreTokens()) { michael@0: storageName = tokenizer.nextToken(); michael@0: } michael@0: michael@0: nsRefPtr f = michael@0: new DeviceStorageFileSystem(storageType, storageName); michael@0: return f.forget(); michael@0: } michael@0: return nullptr; michael@0: } michael@0: michael@0: FileSystemBase::FileSystemBase() michael@0: : mShutdown(false) michael@0: , mIsTesting(false) michael@0: { michael@0: } michael@0: michael@0: FileSystemBase::~FileSystemBase() michael@0: { michael@0: } michael@0: michael@0: void michael@0: FileSystemBase::Shutdown() michael@0: { michael@0: mShutdown = true; michael@0: } michael@0: michael@0: nsPIDOMWindow* michael@0: FileSystemBase::GetWindow() const michael@0: { michael@0: return nullptr; michael@0: } michael@0: michael@0: bool michael@0: FileSystemBase::IsSafeFile(nsIFile* aFile) const michael@0: { michael@0: return false; michael@0: } michael@0: michael@0: bool michael@0: FileSystemBase::IsSafeDirectory(Directory* aDir) const michael@0: { michael@0: return false; michael@0: } michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla