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