OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MASH_BROWSER_BROWSER_H_ | |
6 #define MASH_BROWSER_BROWSER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "mash/public/interfaces/launchable.mojom.h" | |
12 #include "mojo/public/cpp/bindings/binding_set.h" | |
13 #include "services/service_manager/public/cpp/binder_registry.h" | |
14 #include "services/service_manager/public/cpp/service.h" | |
15 | |
16 namespace navigation { | |
17 class View; | |
18 } | |
19 | |
20 namespace views { | |
21 class AuraInit; | |
22 class Widget; | |
23 } | |
24 | |
25 namespace mash { | |
26 namespace browser { | |
27 | |
28 class Browser : public service_manager::Service, public mojom::Launchable { | |
29 public: | |
30 Browser(); | |
31 ~Browser() override; | |
32 | |
33 // Start/stop tracking individual browser windows. When we no longer track any | |
34 // browser windows, the application terminates. The Browser object does not | |
35 // own these widgets. | |
36 void AddWindow(views::Widget* window); | |
37 void RemoveWindow(views::Widget* window); | |
38 | |
39 std::unique_ptr<navigation::View> CreateView(); | |
40 | |
41 private: | |
42 // service_manager::Service: | |
43 void OnStart() override; | |
44 void OnBindInterface(const service_manager::BindSourceInfo& source_info, | |
45 const std::string& interface_name, | |
46 mojo::ScopedMessagePipeHandle interface_pipe) override; | |
47 | |
48 // mojom::Launchable: | |
49 void Launch(uint32_t what, mojom::LaunchMode how) override; | |
50 | |
51 void Create(const service_manager::BindSourceInfo& source_info, | |
52 mojom::LaunchableRequest request); | |
53 | |
54 mojo::BindingSet<mojom::Launchable> bindings_; | |
55 std::vector<views::Widget*> windows_; | |
56 | |
57 service_manager::BinderRegistry registry_; | |
58 | |
59 std::unique_ptr<views::AuraInit> aura_init_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(Browser); | |
62 }; | |
63 | |
64 } // namespace browser | |
65 } // namespace mash | |
66 | |
67 #endif // MASH_BROWSER_BROWSER_H_ | |
OLD | NEW |