Bug 1550519 - Show a translucent parent highlight when a subgrid is highlighted....
[gecko.git] / dom / filesystem / OSFileSystem.h
blob6b433207344926b6bee6f77715b4a429a8d7c408
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=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 #ifndef mozilla_dom_OSFileSystem_h
8 #define mozilla_dom_OSFileSystem_h
10 #include "mozilla/dom/FileSystemBase.h"
12 namespace mozilla {
13 namespace dom {
15 class OSFileSystem final : public FileSystemBase {
16 public:
17 explicit OSFileSystem(const nsAString& aRootDir);
19 void Init(nsISupports* aParent);
21 // Overrides FileSystemBase
23 virtual already_AddRefed<FileSystemBase> Clone() override;
25 virtual bool ShouldCreateDirectory() override {
26 MOZ_CRASH("This should not be called.");
27 // Because OSFileSystem should not be used when the creation of directories
28 // is needed. For that we have OSFileSystemParent.
29 return false;
32 virtual nsISupports* GetParentObject() const override;
34 virtual bool IsSafeFile(nsIFile* aFile) const override;
36 virtual bool IsSafeDirectory(Directory* aDir) const override;
38 virtual void SerializeDOMPath(nsAString& aOutput) const override;
40 // CC methods
41 virtual void Unlink() override;
42 virtual void Traverse(nsCycleCollectionTraversalCallback& cb) override;
44 private:
45 virtual ~OSFileSystem() {}
47 nsCOMPtr<nsISupports> mParent;
50 class OSFileSystemParent final : public FileSystemBase {
51 public:
52 explicit OSFileSystemParent(const nsAString& aRootDir);
54 // Overrides FileSystemBase
56 virtual already_AddRefed<FileSystemBase> Clone() override {
57 MOZ_CRASH("This should not be called on the PBackground thread.");
58 return nullptr;
61 virtual bool ShouldCreateDirectory() override { return false; }
63 virtual nsISupports* GetParentObject() const override {
64 MOZ_CRASH("This should not be called on the PBackground thread.");
65 return nullptr;
68 virtual void GetDirectoryName(nsIFile* aFile, nsAString& aRetval,
69 ErrorResult& aRv) const override {
70 MOZ_CRASH("This should not be called on the PBackground thread.");
73 virtual bool IsSafeFile(nsIFile* aFile) const override { return true; }
75 virtual bool IsSafeDirectory(Directory* aDir) const override {
76 MOZ_CRASH("This should not be called on the PBackground thread.");
77 return true;
80 virtual void SerializeDOMPath(nsAString& aOutput) const override {
81 MOZ_CRASH("This should not be called on the PBackground thread.");
84 // CC methods
85 virtual void Unlink() override {
86 MOZ_CRASH("This should not be called on the PBackground thread.");
89 virtual void Traverse(nsCycleCollectionTraversalCallback& cb) override {
90 MOZ_CRASH("This should not be called on the PBackground thread.");
93 private:
94 virtual ~OSFileSystemParent() {}
97 } // namespace dom
98 } // namespace mozilla
100 #endif // mozilla_dom_OSFileSystem_h