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 #include <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "mash/public/interfaces/launchable.mojom.h" | 8 #include "mash/public/interfaces/launchable.mojom.h" |
9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
10 #include "services/service_manager/public/c/main.h" | 10 #include "services/service_manager/public/c/main.h" |
11 #include "services/service_manager/public/cpp/connection.h" | 11 #include "services/service_manager/public/cpp/connection.h" |
12 #include "services/service_manager/public/cpp/connector.h" | 12 #include "services/service_manager/public/cpp/connector.h" |
13 #include "services/service_manager/public/cpp/service.h" | 13 #include "services/service_manager/public/cpp/service.h" |
14 #include "services/service_manager/public/cpp/service_runner.h" | 14 #include "services/service_manager/public/cpp/service_runner.h" |
15 #include "services/tracing/public/cpp/provider.h" | 15 #include "services/tracing/public/cpp/provider.h" |
16 #include "ui/views/examples/example_base.h" | 16 #include "ui/views/examples/example_base.h" |
17 #include "ui/views/examples/examples_window.h" | 17 #include "ui/views/examples/examples_window.h" |
18 #include "ui/views/mus/aura_init.h" | 18 #include "ui/views/mus/aura_init.h" |
19 #include "ui/views/mus/window_manager_connection.h" | 19 #include "ui/views/mus/window_manager_connection.h" |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 class AuraInit; | 22 class AuraInit; |
23 class WindowManagerConnection; | 23 class WindowManagerConnection; |
24 } | 24 } |
25 | 25 |
26 class ViewsExamples | 26 class ViewsExamples |
27 : public shell::Service, | 27 : public service_manager::Service, |
28 public mash::mojom::Launchable, | 28 public mash::mojom::Launchable, |
29 public shell::InterfaceFactory<mash::mojom::Launchable> { | 29 public service_manager::InterfaceFactory<mash::mojom::Launchable> { |
30 public: | 30 public: |
31 ViewsExamples() {} | 31 ViewsExamples() {} |
32 ~ViewsExamples() override {} | 32 ~ViewsExamples() override {} |
33 | 33 |
34 private: | 34 private: |
35 // shell::Service: | 35 // service_manager::Service: |
36 void OnStart(const shell::Identity& identity) override { | 36 void OnStart(const service_manager::Identity& identity) override { |
37 tracing_.Initialize(connector(), identity.name()); | 37 tracing_.Initialize(connector(), identity.name()); |
38 aura_init_.reset( | 38 aura_init_.reset( |
39 new views::AuraInit(connector(), "views_mus_resources.pak")); | 39 new views::AuraInit(connector(), "views_mus_resources.pak")); |
40 window_manager_connection_ = | 40 window_manager_connection_ = |
41 views::WindowManagerConnection::Create(connector(), identity); | 41 views::WindowManagerConnection::Create(connector(), identity); |
42 } | 42 } |
43 bool OnConnect(const shell::Identity& remote_identity, | 43 bool OnConnect(const service_manager::Identity& remote_identity, |
44 shell::InterfaceRegistry* registry) override { | 44 service_manager::InterfaceRegistry* registry) override { |
45 registry->AddInterface<mash::mojom::Launchable>(this); | 45 registry->AddInterface<mash::mojom::Launchable>(this); |
46 return true; | 46 return true; |
47 } | 47 } |
48 | 48 |
49 // mash::mojom::Launchable: | 49 // mash::mojom::Launchable: |
50 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 50 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
51 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, | 51 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, |
52 nullptr, nullptr); | 52 nullptr, nullptr); |
53 } | 53 } |
54 | 54 |
55 // shell::InterfaceFactory<mash::mojom::Launchable>: | 55 // service_manager::InterfaceFactory<mash::mojom::Launchable>: |
56 void Create(const shell::Identity& remote_identity, | 56 void Create(const service_manager::Identity& remote_identity, |
57 mash::mojom::LaunchableRequest request) override { | 57 mash::mojom::LaunchableRequest request) override { |
58 bindings_.AddBinding(this, std::move(request)); | 58 bindings_.AddBinding(this, std::move(request)); |
59 } | 59 } |
60 | 60 |
61 mojo::BindingSet<mash::mojom::Launchable> bindings_; | 61 mojo::BindingSet<mash::mojom::Launchable> bindings_; |
62 | 62 |
63 tracing::Provider tracing_; | 63 tracing::Provider tracing_; |
64 std::unique_ptr<views::AuraInit> aura_init_; | 64 std::unique_ptr<views::AuraInit> aura_init_; |
65 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 65 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 67 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
68 }; | 68 }; |
69 | 69 |
70 MojoResult ServiceMain(MojoHandle service_request_handle) { | 70 MojoResult ServiceMain(MojoHandle service_request_handle) { |
71 return shell::ServiceRunner(new ViewsExamples).Run(service_request_handle); | 71 return service_manager::ServiceRunner(new ViewsExamples) |
| 72 .Run(service_request_handle); |
72 } | 73 } |
OLD | NEW |