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