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 "mojo/public/cpp/bindings/binding_set.h" | 8 #include "mojo/public/cpp/bindings/binding_set.h" |
9 #include "services/navigation/public/interfaces/view.mojom.h" | 9 #include "services/navigation/public/interfaces/view.mojom.h" |
10 #include "services/shell/public/cpp/interface_factory.h" | 10 #include "services/shell/public/cpp/interface_factory.h" |
11 #include "services/shell/public/cpp/shell_client.h" | 11 #include "services/shell/public/cpp/shell_client.h" |
12 #include "services/shell/public/cpp/shell_connection_ref.h" | 12 #include "services/shell/public/cpp/shell_connection_ref.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 } | 16 } |
17 | 17 |
18 namespace navigation { | 18 namespace navigation { |
19 | 19 |
20 class Navigation : public shell::ShellClient, | 20 class Navigation : public shell::ShellClient, |
21 public shell::InterfaceFactory<mojom::ViewFactory>, | 21 public shell::InterfaceFactory<mojom::ViewFactory>, |
22 public mojom::ViewFactory { | 22 public mojom::ViewFactory { |
23 public: | 23 public: |
24 Navigation(); | 24 Navigation(); |
25 ~Navigation() override; | 25 ~Navigation() override; |
26 | 26 |
27 void SetBrowserContext(content::BrowserContext* browser_context); | 27 void Init(shell::Connector* connector, |
| 28 content::BrowserContext* browser_context); |
28 | 29 |
29 private: | 30 private: |
30 // shell::ShellClient: | 31 // shell::ShellClient: |
31 bool AcceptConnection(shell::Connection* connection) override; | 32 bool AcceptConnection(shell::Connection* connection) override; |
32 | 33 |
33 // shell::InterfaceFactory<mojom::ViewFactory>: | 34 // shell::InterfaceFactory<mojom::ViewFactory>: |
34 void Create(shell::Connection* connection, | 35 void Create(shell::Connection* connection, |
35 mojom::ViewFactoryRequest request) override; | 36 mojom::ViewFactoryRequest request) override; |
36 | 37 |
37 // mojom::ViewFactory: | 38 // mojom::ViewFactory: |
38 void CreateView(mojom::ViewClientPtr client, | 39 void CreateView(mojom::ViewClientPtr client, |
39 mojom::ViewRequest request) override; | 40 mojom::ViewRequest request) override; |
40 | 41 |
41 void ViewFactoryLost(); | 42 void ViewFactoryLost(); |
42 | 43 |
| 44 shell::Connector* connector_ = nullptr; |
43 shell::ShellConnectionRefFactory ref_factory_; | 45 shell::ShellConnectionRefFactory ref_factory_; |
44 std::set<std::unique_ptr<shell::ShellConnectionRef>> refs_; | 46 std::set<std::unique_ptr<shell::ShellConnectionRef>> refs_; |
45 content::BrowserContext* browser_context_ = nullptr; | 47 content::BrowserContext* browser_context_ = nullptr; |
46 mojo::BindingSet<mojom::ViewFactory> bindings_; | 48 mojo::BindingSet<mojom::ViewFactory> bindings_; |
47 std::vector<std::pair<mojom::ViewClientPtr, mojom::ViewRequest>> | 49 std::vector<std::pair<mojom::ViewClientPtr, mojom::ViewRequest>> |
48 pending_creates_; | 50 pending_creates_; |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(Navigation); | 52 DISALLOW_COPY_AND_ASSIGN(Navigation); |
51 }; | 53 }; |
52 | 54 |
53 } // navigation | 55 } // navigation |
54 | 56 |
55 #endif // SERVICES_NAVIGATION_NAVIGATION_H_ | 57 #endif // SERVICES_NAVIGATION_NAVIGATION_H_ |
OLD | NEW |