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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 uint32_t id) { | 44 uint32_t id) { |
45 tracing_.Initialize(connector, identity.name()); | 45 tracing_.Initialize(connector, identity.name()); |
46 } | 46 } |
47 | 47 |
48 bool FileSystemApp::OnConnect(shell::Connection* connection) { | 48 bool FileSystemApp::OnConnect(shell::Connection* connection) { |
49 connection->AddInterface<mojom::FileSystem>(this); | 49 connection->AddInterface<mojom::FileSystem>(this); |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
53 // |InterfaceFactory<Files>| implementation: | 53 // |InterfaceFactory<Files>| implementation: |
54 void FileSystemApp::Create(shell::Connection* connection, | 54 void FileSystemApp::Create(const shell::Identity& remote_identity, |
55 mojo::InterfaceRequest<mojom::FileSystem> request) { | 55 mojo::InterfaceRequest<mojom::FileSystem> request) { |
56 new FileSystemImpl(connection, std::move(request), GetUserDataDir(), | 56 new FileSystemImpl(remote_identity, std::move(request), GetUserDataDir(), |
57 lock_table_); | 57 lock_table_); |
58 } | 58 } |
59 | 59 |
60 //static | 60 //static |
61 base::FilePath FileSystemApp::GetUserDataDir() { | 61 base::FilePath FileSystemApp::GetUserDataDir() { |
62 base::FilePath path; | 62 base::FilePath path; |
63 | 63 |
64 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 64 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
65 if (command_line->HasSwitch(kUserDataDir)) { | 65 if (command_line->HasSwitch(kUserDataDir)) { |
66 path = command_line->GetSwitchValuePath(kUserDataDir); | 66 path = command_line->GetSwitchValuePath(kUserDataDir); |
(...skipping 15 matching lines...) Expand all Loading... |
82 path = path.Append(FILE_PATH_LITERAL("filesystem")); | 82 path = path.Append(FILE_PATH_LITERAL("filesystem")); |
83 } | 83 } |
84 | 84 |
85 if (!base::PathExists(path)) | 85 if (!base::PathExists(path)) |
86 base::CreateDirectory(path); | 86 base::CreateDirectory(path); |
87 | 87 |
88 return path; | 88 return path; |
89 } | 89 } |
90 | 90 |
91 } // namespace filesystem | 91 } // namespace filesystem |
OLD | NEW |