Bumping manifests a=b2g-bump
[gecko.git] / dom / filesystem / FileSystemBase.cpp
blobcf5b00185c914550e5fe97b82b9755e69b4bf988
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/FileSystemBase.h"
9 #include "DeviceStorageFileSystem.h"
10 #include "nsCharSeparatedTokenizer.h"
12 namespace mozilla {
13 namespace dom {
15 // static
16 already_AddRefed<FileSystemBase>
17 FileSystemBase::FromString(const nsAString& aString)
19 if (StringBeginsWith(aString, NS_LITERAL_STRING("devicestorage-"))) {
20 // The string representation of devicestorage file system is of the format:
21 // devicestorage-StorageType-StorageName
23 nsCharSeparatedTokenizer tokenizer(aString, char16_t('-'));
24 tokenizer.nextToken();
26 nsString storageType;
27 if (tokenizer.hasMoreTokens()) {
28 storageType = tokenizer.nextToken();
31 nsString storageName;
32 if (tokenizer.hasMoreTokens()) {
33 storageName = tokenizer.nextToken();
36 nsRefPtr<DeviceStorageFileSystem> f =
37 new DeviceStorageFileSystem(storageType, storageName);
38 return f.forget();
40 return nullptr;
43 FileSystemBase::FileSystemBase()
44 : mShutdown(false)
45 , mIsTesting(false)
49 FileSystemBase::~FileSystemBase()
53 void
54 FileSystemBase::Shutdown()
56 mShutdown = true;
59 nsPIDOMWindow*
60 FileSystemBase::GetWindow() const
62 return nullptr;
65 bool
66 FileSystemBase::IsSafeFile(nsIFile* aFile) const
68 return false;
71 bool
72 FileSystemBase::IsSafeDirectory(Directory* aDir) const
74 return false;
77 } // namespace dom
78 } // namespace mozilla