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 #include "components/filesystem/file_system_app.h" | 5 #include "components/filesystem/file_system_app.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "mojo/shell/public/cpp/connection.h" | 10 #include "mojo/shell/public/cpp/connection.h" |
11 #include "mojo/shell/public/cpp/shell.h" | 11 #include "mojo/shell/public/cpp/connector.h" |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include "base/base_paths_win.h" | 14 #include "base/base_paths_win.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #elif defined(OS_ANDROID) | 17 #elif defined(OS_ANDROID) |
18 #include "base/base_paths_android.h" | 18 #include "base/base_paths_android.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #elif defined(OS_LINUX) | 20 #elif defined(OS_LINUX) |
21 #include "base/environment.h" | 21 #include "base/environment.h" |
22 #include "base/nix/xdg_util.h" | 22 #include "base/nix/xdg_util.h" |
23 #elif defined(OS_MACOSX) | 23 #elif defined(OS_MACOSX) |
24 #include "base/base_paths_mac.h" | 24 #include "base/base_paths_mac.h" |
25 #include "base/path_service.h" | 25 #include "base/path_service.h" |
26 #endif | 26 #endif |
27 | 27 |
28 namespace filesystem { | 28 namespace filesystem { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 const char kUserDataDir[] = "user-data-dir"; | 32 const char kUserDataDir[] = "user-data-dir"; |
33 | 33 |
34 } // namespace filesystem | 34 } // namespace filesystem |
35 | 35 |
36 FileSystemApp::FileSystemApp() | 36 FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {} |
37 : shell_(nullptr), lock_table_(new LockTable) {} | |
38 | 37 |
39 FileSystemApp::~FileSystemApp() {} | 38 FileSystemApp::~FileSystemApp() {} |
40 | 39 |
41 void FileSystemApp::Initialize(mojo::Shell* shell, const std::string& url, | 40 void FileSystemApp::Initialize(mojo::Connector* connector, |
| 41 const std::string& url, |
42 uint32_t id, uint32_t user_id) { | 42 uint32_t id, uint32_t user_id) { |
43 shell_ = shell; | 43 tracing_.Initialize(connector, url); |
44 tracing_.Initialize(shell, url); | |
45 } | 44 } |
46 | 45 |
47 bool FileSystemApp::AcceptConnection(mojo::Connection* connection) { | 46 bool FileSystemApp::AcceptConnection(mojo::Connection* connection) { |
48 connection->AddInterface<FileSystem>(this); | 47 connection->AddInterface<FileSystem>(this); |
49 return true; | 48 return true; |
50 } | 49 } |
51 | 50 |
52 // |InterfaceFactory<Files>| implementation: | 51 // |InterfaceFactory<Files>| implementation: |
53 void FileSystemApp::Create(mojo::Connection* connection, | 52 void FileSystemApp::Create(mojo::Connection* connection, |
54 mojo::InterfaceRequest<FileSystem> request) { | 53 mojo::InterfaceRequest<FileSystem> request) { |
(...skipping 30 matching lines...) Expand all Loading... |
85 #endif | 84 #endif |
86 } | 85 } |
87 | 86 |
88 if (!base::PathExists(path)) | 87 if (!base::PathExists(path)) |
89 base::CreateDirectory(path); | 88 base::CreateDirectory(path); |
90 | 89 |
91 return path; | 90 return path; |
92 } | 91 } |
93 | 92 |
94 } // namespace filesystem | 93 } // namespace filesystem |
OLD | NEW |