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 "services/shell/public/cpp/connection.h" | 10 #include "services/shell/public/cpp/connection.h" |
(...skipping 19 matching lines...) Expand all Loading... |
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() : lock_table_(new LockTable) {} | 36 FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {} |
37 | 37 |
38 FileSystemApp::~FileSystemApp() {} | 38 FileSystemApp::~FileSystemApp() {} |
39 | 39 |
40 void FileSystemApp::Initialize(mojo::Connector* connector, | 40 void FileSystemApp::Initialize(shell::Connector* connector, |
41 const mojo::Identity& identity, | 41 const shell::Identity& identity, |
42 uint32_t id) { | 42 uint32_t id) { |
43 tracing_.Initialize(connector, identity.name()); | 43 tracing_.Initialize(connector, identity.name()); |
44 } | 44 } |
45 | 45 |
46 bool FileSystemApp::AcceptConnection(mojo::Connection* connection) { | 46 bool FileSystemApp::AcceptConnection(shell::Connection* connection) { |
47 connection->AddInterface<FileSystem>(this); | 47 connection->AddInterface<FileSystem>(this); |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 // |InterfaceFactory<Files>| implementation: | 51 // |InterfaceFactory<Files>| implementation: |
52 void FileSystemApp::Create(mojo::Connection* connection, | 52 void FileSystemApp::Create(shell::Connection* connection, |
53 mojo::InterfaceRequest<FileSystem> request) { | 53 mojo::InterfaceRequest<FileSystem> request) { |
54 new FileSystemImpl(connection, std::move(request), GetUserDataDir(), | 54 new FileSystemImpl(connection, std::move(request), GetUserDataDir(), |
55 lock_table_); | 55 lock_table_); |
56 } | 56 } |
57 | 57 |
58 //static | 58 //static |
59 base::FilePath FileSystemApp::GetUserDataDir() { | 59 base::FilePath FileSystemApp::GetUserDataDir() { |
60 base::FilePath path; | 60 base::FilePath path; |
61 | 61 |
62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
(...skipping 17 matching lines...) Expand all Loading... |
80 path = path.Append(FILE_PATH_LITERAL("filesystem")); | 80 path = path.Append(FILE_PATH_LITERAL("filesystem")); |
81 } | 81 } |
82 | 82 |
83 if (!base::PathExists(path)) | 83 if (!base::PathExists(path)) |
84 base::CreateDirectory(path); | 84 base::CreateDirectory(path); |
85 | 85 |
86 return path; | 86 return path; |
87 } | 87 } |
88 | 88 |
89 } // namespace filesystem | 89 } // namespace filesystem |
OLD | NEW |