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 #ifndef COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ | 5 #ifndef COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ |
6 #define COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ | 6 #define COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "components/filesystem/public/interfaces/directory.mojom.h" | 9 #include "components/filesystem/public/interfaces/directory.mojom.h" |
10 #include "components/profile_service/public/interfaces/profile.mojom.h" | 10 #include "components/profile_service/public/interfaces/profile.mojom.h" |
11 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
12 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
13 #include "mojo/shell/public/cpp/connection.h" | 13 #include "mojo/shell/public/cpp/connection.h" |
14 | 14 |
15 namespace filesystem { | 15 namespace filesystem { |
16 class LockTable; | 16 class LockTable; |
17 } | 17 } |
18 | 18 |
| 19 namespace mojo { |
| 20 class MessageLoopRef; |
| 21 } |
| 22 |
19 namespace profile { | 23 namespace profile { |
20 | 24 |
21 // A service which serves directories to callers. | 25 // A service which serves directories to callers. |
22 class ProfileServiceImpl : public ProfileService { | 26 class ProfileServiceImpl : public ProfileService { |
23 public: | 27 public: |
24 ProfileServiceImpl(mojo::Connection* connection, | 28 ProfileServiceImpl(mojo::Connection* connection, |
25 mojo::InterfaceRequest<ProfileService> request, | 29 ProfileServiceRequest request, |
26 base::FilePath base_profile_dir, | 30 scoped_ptr<mojo::MessageLoopRef> ref, |
| 31 const base::FilePath& base_profile_dir, |
27 filesystem::LockTable* lock_table); | 32 filesystem::LockTable* lock_table); |
28 ~ProfileServiceImpl() override; | 33 ~ProfileServiceImpl() override; |
29 | 34 |
30 // Overridden from ProfileService: | 35 // Overridden from ProfileService: |
31 void GetDirectory( | 36 void GetDirectory( |
32 mojo::InterfaceRequest<filesystem::Directory> request) override; | 37 filesystem::DirectoryRequest request, |
| 38 const GetDirectoryCallback& callback) override; |
| 39 void GetSubDirectory( |
| 40 const mojo::String& dir_name, |
| 41 filesystem::DirectoryRequest request, |
| 42 const GetSubDirectoryCallback& callback) override; |
33 | 43 |
34 private: | 44 private: |
| 45 // Causes our application to quit when we go out of scope. |
| 46 scoped_ptr<mojo::MessageLoopRef> message_loop_ref_; |
| 47 |
35 mojo::StrongBinding<ProfileService> binding_; | 48 mojo::StrongBinding<ProfileService> binding_; |
36 filesystem::LockTable* lock_table_; | 49 filesystem::LockTable* lock_table_; |
37 base::FilePath path_; | 50 base::FilePath path_; |
38 | 51 |
39 DISALLOW_COPY_AND_ASSIGN(ProfileServiceImpl); | 52 DISALLOW_COPY_AND_ASSIGN(ProfileServiceImpl); |
40 }; | 53 }; |
41 | 54 |
42 } // namespace profile | 55 } // namespace profile |
43 | 56 |
44 #endif // COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ | 57 #endif // COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ |
OLD | NEW |