ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 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_CATALOG_VIEWER_CATALOG_VIEWER_H_ |
| 6 | #define MASH_CATALOG_VIEWER_CATALOG_VIEWER_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <memory> |
| 10 | |
| 11 | #include "base/callback.h" |
| 12 | #include "base/macros.h" |
Ken Rockot | 388ba4fc | 2018-02-10 17:23:41 | [diff] [blame] | 13 | #include "mash/public/mojom/launchable.mojom.h" |
ben | c62a50fa | 2016-04-18 21:26:31 | [diff] [blame] | 14 | #include "mojo/public/cpp/bindings/binding_set.h" |
ben | 1bd1cf4 | 2017-01-24 22:51:37 | [diff] [blame] | 15 | #include "services/service_manager/public/cpp/binder_registry.h" |
rockot | 734fb66 | 2016-10-15 16:41:30 | [diff] [blame] | 16 | #include "services/service_manager/public/cpp/service.h" |
Ken Rockot | 9d929045 | 2018-11-30 07:01:09 | [diff] [blame] | 17 | #include "services/service_manager/public/cpp/service_binding.h" |
| 18 | #include "services/service_manager/public/mojom/service.mojom.h" |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 19 | |
| 20 | namespace views { |
| 21 | class AuraInit; |
ben | c62a50fa | 2016-04-18 21:26:31 | [diff] [blame] | 22 | class Widget; |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | namespace mash { |
| 26 | namespace catalog_viewer { |
| 27 | |
ben | 2c386b2 | 2017-05-03 00:42:18 | [diff] [blame] | 28 | class CatalogViewer : public service_manager::Service, |
| 29 | public mojom::Launchable { |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 30 | public: |
Ken Rockot | 9d929045 | 2018-11-30 07:01:09 | [diff] [blame] | 31 | explicit CatalogViewer(service_manager::mojom::ServiceRequest request); |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 32 | ~CatalogViewer() override; |
| 33 | |
ben | c62a50fa | 2016-04-18 21:26:31 | [diff] [blame] | 34 | void RemoveWindow(views::Widget* window); |
| 35 | |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 36 | private: |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 37 | // service_manager::Service: |
rockot | 4b5e64d | 2016-11-12 07:47:59 | [diff] [blame] | 38 | void OnStart() override; |
ben | 2c36828d | 2017-05-02 04:09:01 | [diff] [blame] | 39 | void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
ben | 1bd1cf4 | 2017-01-24 22:51:37 | [diff] [blame] | 40 | const std::string& interface_name, |
| 41 | mojo::ScopedMessagePipeHandle interface_pipe) override; |
ben | c62a50fa | 2016-04-18 21:26:31 | [diff] [blame] | 42 | |
| 43 | // mojom::Launchable: |
| 44 | void Launch(uint32_t what, mojom::LaunchMode how) override; |
| 45 | |
Ben Goodger | 21ada1e | 2017-07-19 14:53:01 | [diff] [blame] | 46 | void Create(mojom::LaunchableRequest request); |
ben | c62a50fa | 2016-04-18 21:26:31 | [diff] [blame] | 47 | |
Ken Rockot | 9d929045 | 2018-11-30 07:01:09 | [diff] [blame] | 48 | service_manager::ServiceBinding service_binding_; |
ben | c62a50fa | 2016-04-18 21:26:31 | [diff] [blame] | 49 | mojo::BindingSet<mojom::Launchable> bindings_; |
| 50 | std::vector<views::Widget*> windows_; |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 51 | |
ben | 1bd1cf4 | 2017-01-24 22:51:37 | [diff] [blame] | 52 | service_manager::BinderRegistry registry_; |
| 53 | |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 54 | std::unique_ptr<views::AuraInit> aura_init_; |
ben | 2c1c0be | 2016-04-15 23:13:43 | [diff] [blame] | 55 | |
| 56 | DISALLOW_COPY_AND_ASSIGN(CatalogViewer); |
| 57 | }; |
| 58 | |
| 59 | } // namespace catalog_viewer |
| 60 | } // namespace mash |
| 61 | |
| 62 | #endif // MASH_CATALOG_VIEWER_CATALOG_VIEWER_H_ |