| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 bool FileSystemApp::AcceptConnection(mojo::Connection* connection) { | 46 bool FileSystemApp::AcceptConnection(mojo::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(mojo::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_.get()); | 55 lock_table_); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void FileSystemApp::ShellConnectionLost() { | 58 void FileSystemApp::ShellConnectionLost() { |
| 59 _exit(1); | 59 _exit(1); |
| 60 } | 60 } |
| 61 | 61 |
| 62 //static | 62 //static |
| 63 base::FilePath FileSystemApp::GetUserDataDir() { | 63 base::FilePath FileSystemApp::GetUserDataDir() { |
| 64 base::FilePath path; | 64 base::FilePath path; |
| 65 | 65 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 84 path = path.Append(FILE_PATH_LITERAL("filesystem")); | 84 path = path.Append(FILE_PATH_LITERAL("filesystem")); |
| 85 } | 85 } |
| 86 | 86 |
| 87 if (!base::PathExists(path)) | 87 if (!base::PathExists(path)) |
| 88 base::CreateDirectory(path); | 88 base::CreateDirectory(path); |
| 89 | 89 |
| 90 return path; | 90 return path; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace filesystem | 93 } // namespace filesystem |
| OLD | NEW |