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

Side by Side Diff: services/user/user_service.cc

Issue 1935863002: mojo: Fix leveldb unittests by making fs::Directories cloneable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gyp continues to exist. Created 4 years, 7 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/leveldb/leveldb_service_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/user/user_service.h" 5 #include "services/user/user_service.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.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 "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 10 matching lines...) Expand all
21 const scoped_refptr<filesystem::LockTable>& lock_table) 21 const scoped_refptr<filesystem::LockTable>& lock_table)
22 : lock_table_(lock_table), path_(base_user_dir) { 22 : lock_table_(lock_table), path_(base_user_dir) {
23 base::CreateDirectory(path_); 23 base::CreateDirectory(path_);
24 } 24 }
25 25
26 UserService::~UserService() {} 26 UserService::~UserService() {}
27 27
28 void UserService::GetDirectory(filesystem::DirectoryRequest request, 28 void UserService::GetDirectory(filesystem::DirectoryRequest request,
29 const GetDirectoryCallback& callback) { 29 const GetDirectoryCallback& callback) {
30 new filesystem::DirectoryImpl(std::move(request), path_, 30 new filesystem::DirectoryImpl(std::move(request), path_,
31 std::unique_ptr<base::ScopedTempDir>(), 31 scoped_refptr<filesystem::SharedTempDir>(),
32 lock_table_); 32 lock_table_);
33 callback.Run(); 33 callback.Run();
34 } 34 }
35 35
36 void UserService::GetSubDirectory(const mojo::String& sub_directory_path, 36 void UserService::GetSubDirectory(const mojo::String& sub_directory_path,
37 filesystem::DirectoryRequest request, 37 filesystem::DirectoryRequest request,
38 const GetSubDirectoryCallback& callback) { 38 const GetSubDirectoryCallback& callback) {
39 // Ensure that we've made |subdirectory| recursively under our user dir. 39 // Ensure that we've made |subdirectory| recursively under our user dir.
40 base::FilePath subdir = path_.Append( 40 base::FilePath subdir = path_.Append(
41 #if defined(OS_WIN) 41 #if defined(OS_WIN)
42 base::UTF8ToWide(sub_directory_path.To<std::string>())); 42 base::UTF8ToWide(sub_directory_path.To<std::string>()));
43 #else 43 #else
44 sub_directory_path.To<std::string>()); 44 sub_directory_path.To<std::string>());
45 #endif 45 #endif
46 base::File::Error error; 46 base::File::Error error;
47 if (!base::CreateDirectoryAndGetError(subdir, &error)) { 47 if (!base::CreateDirectoryAndGetError(subdir, &error)) {
48 callback.Run(static_cast<filesystem::FileError>(error)); 48 callback.Run(static_cast<filesystem::FileError>(error));
49 return; 49 return;
50 } 50 }
51 51
52 new filesystem::DirectoryImpl(std::move(request), subdir, 52 new filesystem::DirectoryImpl(std::move(request), subdir,
53 std::unique_ptr<base::ScopedTempDir>(), 53 scoped_refptr<filesystem::SharedTempDir>(),
54 lock_table_); 54 lock_table_);
55 callback.Run(filesystem::FileError::OK); 55 callback.Run(filesystem::FileError::OK);
56 } 56 }
57 57
58 } // namespace user_service 58 } // namespace user_service
OLDNEW
« no previous file with comments | « components/leveldb/leveldb_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698