| 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/shell/public/c/main.h" | 10 #include "services/shell/public/c/main.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 // shell::Service: | 35 // shell::Service: |
| 36 void OnStart(const shell::Identity& identity) override { | 36 void OnStart(const shell::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(shell::Connection* connection) override { | 43 bool OnConnect(const shell::Identity& remote_identity, |
| 44 connection->AddInterface<mash::mojom::Launchable>(this); | 44 shell::InterfaceRegistry* registry) override { |
| 45 registry->AddInterface<mash::mojom::Launchable>(this); |
| 45 return true; | 46 return true; |
| 46 } | 47 } |
| 47 | 48 |
| 48 // mash::mojom::Launchable: | 49 // mash::mojom::Launchable: |
| 49 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 50 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
| 50 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, | 51 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, |
| 51 nullptr, nullptr); | 52 nullptr, nullptr); |
| 52 } | 53 } |
| 53 | 54 |
| 54 // shell::InterfaceFactory<mash::mojom::Launchable>: | 55 // shell::InterfaceFactory<mash::mojom::Launchable>: |
| 55 void Create(const shell::Identity& remote_identity, | 56 void Create(const shell::Identity& remote_identity, |
| 56 mash::mojom::LaunchableRequest request) override { | 57 mash::mojom::LaunchableRequest request) override { |
| 57 bindings_.AddBinding(this, std::move(request)); | 58 bindings_.AddBinding(this, std::move(request)); |
| 58 } | 59 } |
| 59 | 60 |
| 60 mojo::BindingSet<mash::mojom::Launchable> bindings_; | 61 mojo::BindingSet<mash::mojom::Launchable> bindings_; |
| 61 | 62 |
| 62 tracing::Provider tracing_; | 63 tracing::Provider tracing_; |
| 63 std::unique_ptr<views::AuraInit> aura_init_; | 64 std::unique_ptr<views::AuraInit> aura_init_; |
| 64 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 65 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 67 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 MojoResult ServiceMain(MojoHandle service_request_handle) { | 70 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 70 return shell::ServiceRunner(new ViewsExamples).Run(service_request_handle); | 71 return shell::ServiceRunner(new ViewsExamples).Run(service_request_handle); |
| 71 } | 72 } |
| OLD | NEW |