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 |
19 namespace profile { | 20 namespace profile { |
20 | 21 |
21 // A service which serves directories to callers. | 22 // A service which serves directories to callers. |
22 class ProfileServiceImpl : public ProfileService { | 23 class ProfileServiceImpl : public ProfileService { |
23 public: | 24 public: |
24 ProfileServiceImpl(mojo::Connection* connection, | 25 ProfileServiceImpl(mojo::Connection* connection, |
25 mojo::InterfaceRequest<ProfileService> request, | 26 mojo::InterfaceRequest<ProfileService> request, |
| 27 base::Closure on_service_destroyed, |
26 base::FilePath base_profile_dir, | 28 base::FilePath base_profile_dir, |
27 filesystem::LockTable* lock_table); | 29 filesystem::LockTable* lock_table); |
28 ~ProfileServiceImpl() override; | 30 ~ProfileServiceImpl() override; |
29 | 31 |
30 // Overridden from ProfileService: | 32 // Overridden from ProfileService: |
31 void GetDirectory( | 33 void GetDirectory( |
32 mojo::InterfaceRequest<filesystem::Directory> request) override; | 34 mojo::InterfaceRequest<filesystem::Directory> request, |
| 35 const GetDirectoryCallback& callback) override; |
33 | 36 |
34 private: | 37 private: |
| 38 void OnConnectionError(); |
| 39 |
35 mojo::StrongBinding<ProfileService> binding_; | 40 mojo::StrongBinding<ProfileService> binding_; |
| 41 base::Closure on_service_destroyed_; |
36 filesystem::LockTable* lock_table_; | 42 filesystem::LockTable* lock_table_; |
37 base::FilePath path_; | 43 base::FilePath path_; |
38 | 44 |
39 DISALLOW_COPY_AND_ASSIGN(ProfileServiceImpl); | 45 DISALLOW_COPY_AND_ASSIGN(ProfileServiceImpl); |
40 }; | 46 }; |
41 | 47 |
42 } // namespace profile | 48 } // namespace profile |
43 | 49 |
44 #endif // COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ | 50 #endif // COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_ |
OLD | NEW |