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 SERVICES_NAVIGATION_NAVIGATION_H_ | 5 #ifndef SERVICES_NAVIGATION_NAVIGATION_H_ |
6 #define SERVICES_NAVIGATION_NAVIGATION_H_ | 6 #define SERVICES_NAVIGATION_NAVIGATION_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
11 #include "content/public/common/connection_filter.h" | 11 #include "content/public/common/connection_filter.h" |
12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
13 #include "services/navigation/public/interfaces/view.mojom.h" | 13 #include "services/navigation/public/interfaces/view.mojom.h" |
| 14 #include "services/service_manager/public/cpp/binder_registry.h" |
14 #include "services/service_manager/public/cpp/interface_factory.h" | 15 #include "services/service_manager/public/cpp/interface_factory.h" |
15 #include "services/service_manager/public/cpp/service.h" | 16 #include "services/service_manager/public/cpp/service.h" |
16 #include "services/service_manager/public/cpp/service_context_ref.h" | 17 #include "services/service_manager/public/cpp/service_context_ref.h" |
17 | 18 |
18 namespace navigation { | 19 namespace navigation { |
19 | 20 |
20 std::unique_ptr<service_manager::Service> CreateNavigationService(); | 21 std::unique_ptr<service_manager::Service> CreateNavigationService(); |
21 | 22 |
22 class Navigation : public service_manager::Service, public mojom::ViewFactory { | 23 class Navigation : public service_manager::Service, public mojom::ViewFactory { |
23 public: | 24 public: |
24 Navigation(); | 25 Navigation(); |
25 ~Navigation() override; | 26 ~Navigation() override; |
26 | 27 |
27 private: | 28 private: |
28 // service_manager::Service: | 29 // service_manager::Service: |
29 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 30 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
30 service_manager::InterfaceRegistry* registry) override; | 31 const std::string& interface_name, |
| 32 mojo::ScopedMessagePipeHandle interface_pipe) override; |
31 | 33 |
32 // mojom::ViewFactory: | 34 // mojom::ViewFactory: |
33 void CreateView(mojom::ViewClientPtr client, | 35 void CreateView(mojom::ViewClientPtr client, |
34 mojom::ViewRequest request) override; | 36 mojom::ViewRequest request) override; |
35 | 37 |
36 void CreateViewFactory(mojom::ViewFactoryRequest request); | 38 void CreateViewFactory(mojom::ViewFactoryRequest request); |
37 void ViewFactoryLost(); | 39 void ViewFactoryLost(); |
38 | 40 |
39 scoped_refptr<base::SequencedTaskRunner> view_task_runner_; | 41 scoped_refptr<base::SequencedTaskRunner> view_task_runner_; |
40 | 42 |
41 std::string client_user_id_; | 43 std::string client_user_id_; |
42 | 44 |
43 service_manager::ServiceContextRefFactory ref_factory_; | 45 service_manager::ServiceContextRefFactory ref_factory_; |
44 std::set<std::unique_ptr<service_manager::ServiceContextRef>> refs_; | 46 std::set<std::unique_ptr<service_manager::ServiceContextRef>> refs_; |
45 | 47 |
| 48 service_manager::BinderRegistry registry_; |
46 mojo::BindingSet<mojom::ViewFactory> bindings_; | 49 mojo::BindingSet<mojom::ViewFactory> bindings_; |
47 | 50 |
48 base::WeakPtrFactory<Navigation> weak_factory_; | 51 base::WeakPtrFactory<Navigation> weak_factory_; |
49 | 52 |
50 DISALLOW_COPY_AND_ASSIGN(Navigation); | 53 DISALLOW_COPY_AND_ASSIGN(Navigation); |
51 }; | 54 }; |
52 | 55 |
53 } // navigation | 56 } // navigation |
54 | 57 |
55 #endif // SERVICES_NAVIGATION_NAVIGATION_H_ | 58 #endif // SERVICES_NAVIGATION_NAVIGATION_H_ |
OLD | NEW |