Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: components/filesystem/file_system_impl.cc

Issue 1720603002: Revert of mojo: Get mojo:leveldb and mojo:filesystem compiled into content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/filesystem/file_system_impl.h ('k') | components/filesystem/filesystem.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "mojo/shell/public/cpp/connection.h" 20 #include "mojo/shell/public/cpp/connection.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 #if defined(OS_WIN) 23 #if defined(OS_WIN)
23 #include "base/base_paths_win.h" 24 #include "base/base_paths_win.h"
24 #include "base/path_service.h" 25 #include "base/path_service.h"
25 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
26 #elif defined(OS_ANDROID) 27 #elif defined(OS_ANDROID)
27 #include "base/base_paths_android.h" 28 #include "base/base_paths_android.h"
28 #include "base/path_service.h" 29 #include "base/path_service.h"
29 #elif defined(OS_LINUX) 30 #elif defined(OS_LINUX)
30 #include "base/environment.h" 31 #include "base/environment.h"
31 #include "base/nix/xdg_util.h" 32 #include "base/nix/xdg_util.h"
32 #elif defined(OS_MACOSX) 33 #elif defined(OS_MACOSX)
33 #include "base/base_paths_mac.h" 34 #include "base/base_paths_mac.h"
34 #include "base/path_service.h" 35 #include "base/path_service.h"
35 #endif 36 #endif
36 37
37 namespace filesystem { 38 namespace filesystem {
38 39
39 namespace { 40 namespace {
40 41
41 const char kEscapeChar = ','; 42 const char kEscapeChar = ',';
42 43
43 const char kUserDataDir[] = "user-data-dir"; 44 const char kUserDataDir[] = "user-data-dir";
44 45
45 } // namespace filesystem 46 } // namespace filesystem
46 47
47 FileSystemImpl::FileSystemImpl(mojo::Connection* connection, 48 FileSystemImpl::FileSystemImpl(FileSystemApp* app,
49 mojo::Connection* connection,
48 mojo::InterfaceRequest<FileSystem> request, 50 mojo::InterfaceRequest<FileSystem> request,
49 LockTable* lock_table) 51 LockTable* lock_table)
50 : remote_application_url_(connection->GetRemoteApplicationURL()), 52 : app_(app),
53 remote_application_url_(connection->GetRemoteApplicationURL()),
51 binding_(this, std::move(request)), 54 binding_(this, std::move(request)),
52 lock_table_(lock_table) {} 55 lock_table_(lock_table) {}
53 56
54 FileSystemImpl::~FileSystemImpl() { 57 FileSystemImpl::~FileSystemImpl() {
55 } 58 }
56 59
57 void FileSystemImpl::OpenFileSystem(const mojo::String& file_system, 60 void FileSystemImpl::OpenFileSystem(const mojo::String& file_system,
58 mojo::InterfaceRequest<Directory> directory, 61 mojo::InterfaceRequest<Directory> directory,
59 FileSystemClientPtr client, 62 FileSystemClientPtr client,
60 const OpenFileSystemCallback& callback) { 63 const OpenFileSystemCallback& callback) {
(...skipping 18 matching lines...) Expand all
79 #if defined(OS_WIN) 82 #if defined(OS_WIN)
80 path = base_profile_dir.Append(base::UTF8ToWide(sanitized_origin)); 83 path = base_profile_dir.Append(base::UTF8ToWide(sanitized_origin));
81 #else 84 #else
82 path = base_profile_dir.Append(sanitized_origin); 85 path = base_profile_dir.Append(sanitized_origin);
83 #endif 86 #endif
84 if (!base::PathExists(path)) 87 if (!base::PathExists(path))
85 base::CreateDirectory(path); 88 base::CreateDirectory(path);
86 } 89 }
87 90
88 if (!path.empty()) { 91 if (!path.empty()) {
89 new DirectoryImpl( 92 DirectoryImpl* dir_impl = new DirectoryImpl(
90 std::move(directory), path, std::move(temp_dir), lock_table_); 93 std::move(directory), path, std::move(temp_dir), lock_table_);
94 app_->RegisterDirectoryToClient(dir_impl, std::move(client));
91 callback.Run(FileError::OK); 95 callback.Run(FileError::OK);
92 } else { 96 } else {
93 callback.Run(FileError::FAILED); 97 callback.Run(FileError::FAILED);
94 } 98 }
95 } 99 }
96 100
97 base::FilePath FileSystemImpl::GetSystemProfileDir() const { 101 base::FilePath FileSystemImpl::GetSystemProfileDir() const {
98 base::FilePath path; 102 base::FilePath path;
99 103
100 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 104 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 encoded[1] += (encoded[1] >= 10) ? 'A' - 10 : '0'; 155 encoded[1] += (encoded[1] >= 10) ? 'A' - 10 : '0';
152 encoded[2] = ch % 16; 156 encoded[2] = ch % 16;
153 encoded[2] += (encoded[2] >= 10) ? 'A' - 10 : '0'; 157 encoded[2] += (encoded[2] >= 10) ? 'A' - 10 : '0';
154 encoded_len = 3; 158 encoded_len = 3;
155 } 159 }
156 sanitized_origin->append(encoded, encoded_len); 160 sanitized_origin->append(encoded, encoded_len);
157 } 161 }
158 } 162 }
159 163
160 } // namespace filesystem 164 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/file_system_impl.h ('k') | components/filesystem/filesystem.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698