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 MASH_BROWSER_BROWSER_H_ | 5 #ifndef MASH_BROWSER_BROWSER_H_ |
6 #define MASH_BROWSER_BROWSER_H_ | 6 #define MASH_BROWSER_BROWSER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "mash/public/interfaces/launchable.mojom.h" | 11 #include "mash/public/interfaces/launchable.mojom.h" |
12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
13 #include "services/service_manager/public/cpp/interface_factory.h" | 13 #include "services/service_manager/public/cpp/interface_factory.h" |
14 #include "services/service_manager/public/cpp/service.h" | 14 #include "services/service_manager/public/cpp/service.h" |
15 #include "services/tracing/public/cpp/provider.h" | 15 #include "services/tracing/public/cpp/provider.h" |
16 | 16 |
17 namespace navigation { | 17 namespace navigation { |
18 class View; | 18 class View; |
19 } | 19 } |
20 | 20 |
| 21 namespace service_manager { |
| 22 class ServiceContext; |
| 23 } |
| 24 |
21 namespace views { | 25 namespace views { |
22 class AuraInit; | 26 class AuraInit; |
23 class Widget; | 27 class Widget; |
24 class WindowManagerConnection; | 28 class WindowManagerConnection; |
25 } | 29 } |
26 | 30 |
27 namespace mash { | 31 namespace mash { |
28 namespace browser { | 32 namespace browser { |
29 | 33 |
30 class Browser : public service_manager::Service, | 34 class Browser : public service_manager::Service, |
31 public mojom::Launchable, | 35 public mojom::Launchable, |
32 public service_manager::InterfaceFactory<mojom::Launchable> { | 36 public service_manager::InterfaceFactory<mojom::Launchable> { |
33 public: | 37 public: |
34 Browser(); | 38 Browser(); |
35 ~Browser() override; | 39 ~Browser() override; |
36 | 40 |
37 // Start/stop tracking individual browser windows. When we no longer track any | 41 // Start/stop tracking individual browser windows. When we no longer track any |
38 // browser windows, the application terminates. The Browser object does not | 42 // browser windows, the application terminates. The Browser object does not |
39 // own these widgets. | 43 // own these widgets. |
40 void AddWindow(views::Widget* window); | 44 void AddWindow(views::Widget* window); |
41 void RemoveWindow(views::Widget* window); | 45 void RemoveWindow(views::Widget* window); |
42 | 46 |
43 std::unique_ptr<navigation::View> CreateView(); | 47 std::unique_ptr<navigation::View> CreateView(); |
44 | 48 |
45 private: | 49 private: |
46 // service_manager::Service: | 50 // service_manager::Service: |
47 void OnStart() override; | 51 void OnStart(service_manager::ServiceContext* context) override; |
48 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 52 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
49 service_manager::InterfaceRegistry* registry) override; | 53 service_manager::InterfaceRegistry* registry) override; |
50 | 54 |
51 // mojom::Launchable: | 55 // mojom::Launchable: |
52 void Launch(uint32_t what, mojom::LaunchMode how) override; | 56 void Launch(uint32_t what, mojom::LaunchMode how) override; |
53 | 57 |
54 // service_manager::InterfaceFactory<mojom::Launchable>: | 58 // service_manager::InterfaceFactory<mojom::Launchable>: |
55 void Create(const service_manager::Identity& remote_identity, | 59 void Create(const service_manager::Identity& remote_identity, |
56 mojom::LaunchableRequest request) override; | 60 mojom::LaunchableRequest request) override; |
57 | 61 |
| 62 service_manager::ServiceContext* context_ = nullptr; |
| 63 |
58 mojo::BindingSet<mojom::Launchable> bindings_; | 64 mojo::BindingSet<mojom::Launchable> bindings_; |
59 std::vector<views::Widget*> windows_; | 65 std::vector<views::Widget*> windows_; |
60 | 66 |
61 tracing::Provider tracing_; | 67 tracing::Provider tracing_; |
62 std::unique_ptr<views::AuraInit> aura_init_; | 68 std::unique_ptr<views::AuraInit> aura_init_; |
63 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 69 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
64 | 70 |
65 DISALLOW_COPY_AND_ASSIGN(Browser); | 71 DISALLOW_COPY_AND_ASSIGN(Browser); |
66 }; | 72 }; |
67 | 73 |
68 } // namespace browser | 74 } // namespace browser |
69 } // namespace mash | 75 } // namespace mash |
70 | 76 |
71 #endif // MASH_BROWSER_BROWSER_H_ | 77 #endif // MASH_BROWSER_BROWSER_H_ |
OLD | NEW |