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_impl.h" | 5 #include "components/filesystem/file_system_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/files/scoped_file.h" | 13 #include "base/files/scoped_file.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "components/filesystem/directory_impl.h" | 18 #include "components/filesystem/directory_impl.h" |
19 #include "components/filesystem/file_system_app.h" | 19 #include "components/filesystem/file_system_app.h" |
20 #include "mojo/shell/public/cpp/application_connection.h" | 20 #include "mojo/shell/public/cpp/connection.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
22 | 22 |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 #include "base/base_paths_win.h" | 24 #include "base/base_paths_win.h" |
25 #include "base/path_service.h" | 25 #include "base/path_service.h" |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #elif defined(OS_ANDROID) | 27 #elif defined(OS_ANDROID) |
28 #include "base/base_paths_android.h" | 28 #include "base/base_paths_android.h" |
29 #include "base/path_service.h" | 29 #include "base/path_service.h" |
30 #elif defined(OS_LINUX) | 30 #elif defined(OS_LINUX) |
31 #include "base/environment.h" | 31 #include "base/environment.h" |
32 #include "base/nix/xdg_util.h" | 32 #include "base/nix/xdg_util.h" |
33 #elif defined(OS_MACOSX) | 33 #elif defined(OS_MACOSX) |
34 #include "base/base_paths_mac.h" | 34 #include "base/base_paths_mac.h" |
35 #include "base/path_service.h" | 35 #include "base/path_service.h" |
36 #endif | 36 #endif |
37 | 37 |
38 namespace filesystem { | 38 namespace filesystem { |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 const char kEscapeChar = ','; | 42 const char kEscapeChar = ','; |
43 | 43 |
44 const char kUserDataDir[] = "user-data-dir"; | 44 const char kUserDataDir[] = "user-data-dir"; |
45 | 45 |
46 } // namespace filesystem | 46 } // namespace filesystem |
47 | 47 |
48 FileSystemImpl::FileSystemImpl(FileSystemApp* app, | 48 FileSystemImpl::FileSystemImpl(FileSystemApp* app, |
49 mojo::ApplicationConnection* connection, | 49 mojo::Connection* connection, |
50 mojo::InterfaceRequest<FileSystem> request) | 50 mojo::InterfaceRequest<FileSystem> request) |
51 : app_(app), | 51 : app_(app), |
52 remote_application_url_(connection->GetRemoteApplicationURL()), | 52 remote_application_url_(connection->GetRemoteApplicationURL()), |
53 binding_(this, std::move(request)) {} | 53 binding_(this, std::move(request)) {} |
54 | 54 |
55 FileSystemImpl::~FileSystemImpl() { | 55 FileSystemImpl::~FileSystemImpl() { |
56 } | 56 } |
57 | 57 |
58 void FileSystemImpl::OpenFileSystem(const mojo::String& file_system, | 58 void FileSystemImpl::OpenFileSystem(const mojo::String& file_system, |
59 mojo::InterfaceRequest<Directory> directory, | 59 mojo::InterfaceRequest<Directory> directory, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 encoded[1] += (encoded[1] >= 10) ? 'A' - 10 : '0'; | 153 encoded[1] += (encoded[1] >= 10) ? 'A' - 10 : '0'; |
154 encoded[2] = ch % 16; | 154 encoded[2] = ch % 16; |
155 encoded[2] += (encoded[2] >= 10) ? 'A' - 10 : '0'; | 155 encoded[2] += (encoded[2] >= 10) ? 'A' - 10 : '0'; |
156 encoded_len = 3; | 156 encoded_len = 3; |
157 } | 157 } |
158 sanitized_origin->append(encoded, encoded_len); | 158 sanitized_origin->append(encoded, encoded_len); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 } // namespace filesystem | 162 } // namespace filesystem |
OLD | NEW |