| 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 "base/memory/ptr_util.h" |
| 9 #include "mash/public/interfaces/launchable.mojom.h" | 9 #include "mash/public/interfaces/launchable.mojom.h" |
| 10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class ViewsExamples | 30 class ViewsExamples |
| 31 : public service_manager::Service, | 31 : public service_manager::Service, |
| 32 public mash::mojom::Launchable, | 32 public mash::mojom::Launchable, |
| 33 public service_manager::InterfaceFactory<mash::mojom::Launchable> { | 33 public service_manager::InterfaceFactory<mash::mojom::Launchable> { |
| 34 public: | 34 public: |
| 35 ViewsExamples() {} | 35 ViewsExamples() {} |
| 36 ~ViewsExamples() override {} | 36 ~ViewsExamples() override {} |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // service_manager::Service: | 39 // service_manager::Service: |
| 40 void OnStart(service_manager::ServiceContext* context) override { | 40 void OnStart() override { |
| 41 tracing_.Initialize(context->connector(), context->identity().name()); | 41 tracing_.Initialize(context()->connector(), context()->identity().name()); |
| 42 aura_init_ = base::MakeUnique<views::AuraInit>( | 42 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 43 context->connector(), context->identity(), "views_mus_resources.pak"); | 43 context()->connector(), context()->identity(), |
| 44 "views_mus_resources.pak"); |
| 44 window_manager_connection_ = views::WindowManagerConnection::Create( | 45 window_manager_connection_ = views::WindowManagerConnection::Create( |
| 45 context->connector(), context->identity()); | 46 context()->connector(), context()->identity()); |
| 46 } | 47 } |
| 47 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 48 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 48 service_manager::InterfaceRegistry* registry) override { | 49 service_manager::InterfaceRegistry* registry) override { |
| 49 registry->AddInterface<mash::mojom::Launchable>(this); | 50 registry->AddInterface<mash::mojom::Launchable>(this); |
| 50 return true; | 51 return true; |
| 51 } | 52 } |
| 52 | 53 |
| 53 // mash::mojom::Launchable: | 54 // mash::mojom::Launchable: |
| 54 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 55 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
| 55 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, | 56 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 std::unique_ptr<views::AuraInit> aura_init_; | 69 std::unique_ptr<views::AuraInit> aura_init_; |
| 69 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 70 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
| 70 | 71 |
| 71 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 72 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 MojoResult ServiceMain(MojoHandle service_request_handle) { | 75 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 75 return service_manager::ServiceRunner(new ViewsExamples) | 76 return service_manager::ServiceRunner(new ViewsExamples) |
| 76 .Run(service_request_handle); | 77 .Run(service_request_handle); |
| 77 } | 78 } |
| OLD | NEW |