1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/filesystem/FileSystemBase.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,78 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "mozilla/dom/FileSystemBase.h" 1.11 + 1.12 +#include "DeviceStorageFileSystem.h" 1.13 +#include "nsCharSeparatedTokenizer.h" 1.14 + 1.15 +namespace mozilla { 1.16 +namespace dom { 1.17 + 1.18 +// static 1.19 +already_AddRefed<FileSystemBase> 1.20 +FileSystemBase::FromString(const nsAString& aString) 1.21 +{ 1.22 + if (StringBeginsWith(aString, NS_LITERAL_STRING("devicestorage-"))) { 1.23 + // The string representation of devicestorage file system is of the format: 1.24 + // devicestorage-StorageType-StorageName 1.25 + 1.26 + nsCharSeparatedTokenizer tokenizer(aString, char16_t('-')); 1.27 + tokenizer.nextToken(); 1.28 + 1.29 + nsString storageType; 1.30 + if (tokenizer.hasMoreTokens()) { 1.31 + storageType = tokenizer.nextToken(); 1.32 + } 1.33 + 1.34 + nsString storageName; 1.35 + if (tokenizer.hasMoreTokens()) { 1.36 + storageName = tokenizer.nextToken(); 1.37 + } 1.38 + 1.39 + nsRefPtr<DeviceStorageFileSystem> f = 1.40 + new DeviceStorageFileSystem(storageType, storageName); 1.41 + return f.forget(); 1.42 + } 1.43 + return nullptr; 1.44 +} 1.45 + 1.46 +FileSystemBase::FileSystemBase() 1.47 + : mShutdown(false) 1.48 + , mIsTesting(false) 1.49 +{ 1.50 +} 1.51 + 1.52 +FileSystemBase::~FileSystemBase() 1.53 +{ 1.54 +} 1.55 + 1.56 +void 1.57 +FileSystemBase::Shutdown() 1.58 +{ 1.59 + mShutdown = true; 1.60 +} 1.61 + 1.62 +nsPIDOMWindow* 1.63 +FileSystemBase::GetWindow() const 1.64 +{ 1.65 + return nullptr; 1.66 +} 1.67 + 1.68 +bool 1.69 +FileSystemBase::IsSafeFile(nsIFile* aFile) const 1.70 +{ 1.71 + return false; 1.72 +} 1.73 + 1.74 +bool 1.75 +FileSystemBase::IsSafeDirectory(Directory* aDir) const 1.76 +{ 1.77 + return false; 1.78 +} 1.79 + 1.80 +} // namespace dom 1.81 +} // namespace mozilla