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"
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();
27 if (tokenizer
.hasMoreTokens()) {
28 storageType
= tokenizer
.nextToken();
32 if (tokenizer
.hasMoreTokens()) {
33 storageName
= tokenizer
.nextToken();
36 nsRefPtr
<DeviceStorageFileSystem
> f
=
37 new DeviceStorageFileSystem(storageType
, storageName
);
43 FileSystemBase::FileSystemBase()
49 FileSystemBase::~FileSystemBase()
54 FileSystemBase::Shutdown()
60 FileSystemBase::GetWindow() const
66 FileSystemBase::IsSafeFile(nsIFile
* aFile
) const
72 FileSystemBase::IsSafeDirectory(Directory
* aDir
) const
78 } // namespace mozilla