Don't preload rarely seen large images
[chromium-blink-merge.git] / components / filesystem / directory_impl.h
blobed19d007c188013976d1326d1a8ad31790e7d529
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_
6 #define COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_
8 #include "base/files/file_path.h"
9 #include "base/files/scoped_file.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/filesystem/public/interfaces/directory.mojom.h"
13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
16 namespace base {
17 class ScopedTempDir;
18 } // namespace base
20 namespace filesystem {
22 class DirectoryImpl : public Directory {
23 public:
24 // Set |temp_dir| only if there's a temporary directory that should be deleted
25 // when this object is destroyed.
26 DirectoryImpl(mojo::InterfaceRequest<Directory> request,
27 base::FilePath directory_path,
28 scoped_ptr<base::ScopedTempDir> temp_dir);
29 ~DirectoryImpl() override;
31 // |Directory| implementation:
32 void Read(const ReadCallback& callback) override;
33 void OpenFile(const mojo::String& path,
34 mojo::InterfaceRequest<File> file,
35 uint32_t open_flags,
36 const OpenFileCallback& callback) override;
37 void OpenDirectory(const mojo::String& path,
38 mojo::InterfaceRequest<Directory> directory,
39 uint32_t open_flags,
40 const OpenDirectoryCallback& callback) override;
41 void Rename(const mojo::String& path,
42 const mojo::String& new_path,
43 const RenameCallback& callback) override;
44 void Delete(const mojo::String& path,
45 uint32_t delete_flags,
46 const DeleteCallback& callback) override;
47 void Exists(const mojo::String& path,
48 const ExistsCallback& callback) override;
49 void IsWritable(const mojo::String& path,
50 const IsWritableCallback& callback) override;
51 void Flush(const FlushCallback& callback) override;
53 private:
54 mojo::StrongBinding<Directory> binding_;
55 base::FilePath directory_path_;
56 scoped_ptr<base::ScopedTempDir> temp_dir_;
58 DISALLOW_COPY_AND_ASSIGN(DirectoryImpl);
61 } // namespace filesystem
63 #endif // COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_