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