Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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)
18 {
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();
29 }
31 nsString storageName;
32 if (tokenizer.hasMoreTokens()) {
33 storageName = tokenizer.nextToken();
34 }
36 nsRefPtr<DeviceStorageFileSystem> f =
37 new DeviceStorageFileSystem(storageType, storageName);
38 return f.forget();
39 }
40 return nullptr;
41 }
43 FileSystemBase::FileSystemBase()
44 : mShutdown(false)
45 , mIsTesting(false)
46 {
47 }
49 FileSystemBase::~FileSystemBase()
50 {
51 }
53 void
54 FileSystemBase::Shutdown()
55 {
56 mShutdown = true;
57 }
59 nsPIDOMWindow*
60 FileSystemBase::GetWindow() const
61 {
62 return nullptr;
63 }
65 bool
66 FileSystemBase::IsSafeFile(nsIFile* aFile) const
67 {
68 return false;
69 }
71 bool
72 FileSystemBase::IsSafeDirectory(Directory* aDir) const
73 {
74 return false;
75 }
77 } // namespace dom
78 } // namespace mozilla