OLD | NEW |
---|---|
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 "components/profile_service/profile_service_impl.h" | 5 #include "components/profile_service/profile_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | |
7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
10 #include "components/filesystem/directory_impl.h" | 11 #include "components/filesystem/directory_impl.h" |
11 #include "components/filesystem/lock_table.h" | 12 #include "components/filesystem/lock_table.h" |
12 #include "mojo/shell/public/cpp/connection.h" | 13 #include "mojo/shell/public/cpp/connection.h" |
14 #include "mojo/shell/public/cpp/message_loop_ref.h" | |
13 | 15 |
14 namespace profile { | 16 namespace profile { |
15 | 17 |
16 ProfileServiceImpl::ProfileServiceImpl( | 18 ProfileServiceImpl::ProfileServiceImpl( |
17 mojo::Connection* connection, | 19 mojo::Connection* connection, |
18 mojo::InterfaceRequest<ProfileService> request, | 20 mojo::InterfaceRequest<ProfileService> request, |
21 scoped_ptr<mojo::MessageLoopRef> ref, | |
19 base::FilePath base_profile_dir, | 22 base::FilePath base_profile_dir, |
michaeln
2016/03/05 01:38:54
const ref for the FilePath&
| |
20 filesystem::LockTable* lock_table) | 23 filesystem::LockTable* lock_table) |
21 : binding_(this, std::move(request)), | 24 : message_loop_ref_(std::move(ref)), |
25 binding_(this, std::move(request)), | |
22 lock_table_(lock_table), | 26 lock_table_(lock_table), |
23 path_(base_profile_dir) { | 27 path_(base_profile_dir) { |
24 if (!base::PathExists(path_)) | 28 if (!base::PathExists(path_)) |
25 base::CreateDirectory(path_); | 29 base::CreateDirectory(path_); |
26 } | 30 } |
27 | 31 |
28 ProfileServiceImpl::~ProfileServiceImpl() { | 32 ProfileServiceImpl::~ProfileServiceImpl() {} |
29 } | |
30 | 33 |
31 void ProfileServiceImpl::GetDirectory( | 34 void ProfileServiceImpl::GetDirectory( |
32 mojo::InterfaceRequest<filesystem::Directory> request) { | 35 mojo::InterfaceRequest<filesystem::Directory> request, |
36 const GetDirectoryCallback& callback) { | |
33 new filesystem::DirectoryImpl(std::move(request), | 37 new filesystem::DirectoryImpl(std::move(request), |
34 path_, | 38 path_, |
35 scoped_ptr<base::ScopedTempDir>(), | 39 scoped_ptr<base::ScopedTempDir>(), |
36 lock_table_); | 40 lock_table_); |
41 callback.Run(filesystem::FileError::OK); | |
michaeln
2016/03/05 01:38:54
If this method can never fail, we don't need a err
Elliot Glaysher
2016/03/10 21:00:35
Problem: This method can never fail. Resolution: r
| |
37 } | 42 } |
38 | 43 |
39 } // namespace profile | 44 } // namespace profile |
OLD | NEW |