OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ |
6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ | 6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/filesystem/directory_impl.h" | 9 #include "components/filesystem/directory_impl.h" |
10 #include "components/filesystem/file_system_impl.h" | 10 #include "components/filesystem/file_system_impl.h" |
11 #include "components/filesystem/lock_table.h" | 11 #include "components/filesystem/lock_table.h" |
12 #include "components/filesystem/public/interfaces/file_system.mojom.h" | 12 #include "components/filesystem/public/interfaces/file_system.mojom.h" |
13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
14 #include "mojo/shell/public/cpp/interface_factory.h" | 14 #include "mojo/shell/public/cpp/interface_factory.h" |
15 #include "mojo/shell/public/cpp/shell_client.h" | 15 #include "mojo/shell/public/cpp/shell_client.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 class Shell; | 18 class Shell; |
19 } | 19 } |
20 | 20 |
21 namespace filesystem { | 21 namespace filesystem { |
22 | 22 |
23 scoped_ptr<mojo::ShellClient> CreateFileSystemApp( | |
24 const base::FilePath& persistent_dir); | |
25 | |
23 class FileSystemApp : public mojo::ShellClient, | 26 class FileSystemApp : public mojo::ShellClient, |
24 public mojo::InterfaceFactory<FileSystem> { | 27 public mojo::InterfaceFactory<FileSystem> { |
25 public: | 28 public: |
26 FileSystemApp(); | 29 FileSystemApp(const base::FilePath& persistent_dir); |
michaeln
2016/02/26 21:59:24
root_directory or plain old directory are less loa
| |
27 ~FileSystemApp() override; | 30 ~FileSystemApp() override; |
28 | 31 |
29 private: | 32 private: |
30 // Gets the system specific toplevel profile directory. | |
31 static base::FilePath GetUserDataDir(); | |
32 | |
33 // |mojo::ShellClient| override: | 33 // |mojo::ShellClient| override: |
34 void Initialize(mojo::Shell* shell, const std::string& url, | 34 void Initialize(mojo::Shell* shell, const std::string& url, |
35 uint32_t id, uint32_t user_id) override; | 35 uint32_t id, uint32_t user_id) override; |
36 bool AcceptConnection(mojo::Connection* connection) override; | 36 bool AcceptConnection(mojo::Connection* connection) override; |
37 | 37 |
38 // |InterfaceFactory<Files>| implementation: | 38 // |InterfaceFactory<Files>| implementation: |
39 void Create(mojo::Connection* connection, | 39 void Create(mojo::Connection* connection, |
40 mojo::InterfaceRequest<FileSystem> request) override; | 40 mojo::InterfaceRequest<FileSystem> request) override; |
41 | 41 |
42 mojo::Shell* shell_; | 42 mojo::Shell* shell_; |
43 mojo::TracingImpl tracing_; | 43 mojo::TracingImpl tracing_; |
44 | 44 |
45 scoped_ptr<LockTable> lock_table_; | 45 scoped_ptr<LockTable> lock_table_; |
46 | 46 |
47 base::FilePath persistent_dir_; | |
48 | |
47 DISALLOW_COPY_AND_ASSIGN(FileSystemApp); | 49 DISALLOW_COPY_AND_ASSIGN(FileSystemApp); |
48 }; | 50 }; |
49 | 51 |
50 } // namespace filesystem | 52 } // namespace filesystem |
51 | 53 |
52 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ | 54 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ |
OLD | NEW |