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