| 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 "base/memory/ptr_util.h" |
| 8 #include "mash/public/interfaces/launchable.mojom.h" | 9 #include "mash/public/interfaces/launchable.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
| 10 #include "services/service_manager/public/c/main.h" | 11 #include "services/service_manager/public/c/main.h" |
| 11 #include "services/service_manager/public/cpp/connection.h" | 12 #include "services/service_manager/public/cpp/connection.h" |
| 12 #include "services/service_manager/public/cpp/connector.h" | 13 #include "services/service_manager/public/cpp/connector.h" |
| 13 #include "services/service_manager/public/cpp/service.h" | 14 #include "services/service_manager/public/cpp/service.h" |
| 14 #include "services/service_manager/public/cpp/service_runner.h" | 15 #include "services/service_manager/public/cpp/service_runner.h" |
| 15 #include "services/tracing/public/cpp/provider.h" | 16 #include "services/tracing/public/cpp/provider.h" |
| 16 #include "ui/views/examples/example_base.h" | 17 #include "ui/views/examples/example_base.h" |
| 17 #include "ui/views/examples/examples_window.h" | 18 #include "ui/views/examples/examples_window.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 28 public mash::mojom::Launchable, | 29 public mash::mojom::Launchable, |
| 29 public service_manager::InterfaceFactory<mash::mojom::Launchable> { | 30 public service_manager::InterfaceFactory<mash::mojom::Launchable> { |
| 30 public: | 31 public: |
| 31 ViewsExamples() {} | 32 ViewsExamples() {} |
| 32 ~ViewsExamples() override {} | 33 ~ViewsExamples() override {} |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // service_manager::Service: | 36 // service_manager::Service: |
| 36 void OnStart(const service_manager::ServiceInfo& info) override { | 37 void OnStart(const service_manager::ServiceInfo& info) override { |
| 37 tracing_.Initialize(connector(), info.identity.name()); | 38 tracing_.Initialize(connector(), info.identity.name()); |
| 38 aura_init_.reset( | 39 aura_init_ = base::MakeUnique<views::AuraInit>(connector(), info.identity, |
| 39 new views::AuraInit(connector(), "views_mus_resources.pak")); | 40 "views_mus_resources.pak"); |
| 40 window_manager_connection_ = | 41 window_manager_connection_ = |
| 41 views::WindowManagerConnection::Create(connector(), info.identity); | 42 views::WindowManagerConnection::Create(connector(), info.identity); |
| 42 } | 43 } |
| 43 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 44 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 44 service_manager::InterfaceRegistry* registry) override { | 45 service_manager::InterfaceRegistry* registry) override { |
| 45 registry->AddInterface<mash::mojom::Launchable>(this); | 46 registry->AddInterface<mash::mojom::Launchable>(this); |
| 46 return true; | 47 return true; |
| 47 } | 48 } |
| 48 | 49 |
| 49 // mash::mojom::Launchable: | 50 // mash::mojom::Launchable: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 64 std::unique_ptr<views::AuraInit> aura_init_; | 65 std::unique_ptr<views::AuraInit> aura_init_; |
| 65 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 66 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
| 66 | 67 |
| 67 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 68 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 MojoResult ServiceMain(MojoHandle service_request_handle) { | 71 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 71 return service_manager::ServiceRunner(new ViewsExamples) | 72 return service_manager::ServiceRunner(new ViewsExamples) |
| 72 .Run(service_request_handle); | 73 .Run(service_request_handle); |
| 73 } | 74 } |
| OLD | NEW |