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() override { | 40 void OnStart(service_manager::ServiceContext* context) 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(), | 43 context->connector(), context->identity(), "views_mus_resources.pak"); |
44 "views_mus_resources.pak"); | |
45 window_manager_connection_ = views::WindowManagerConnection::Create( | 44 window_manager_connection_ = views::WindowManagerConnection::Create( |
46 context()->connector(), context()->identity()); | 45 context->connector(), context->identity()); |
47 } | 46 } |
48 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 47 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
49 service_manager::InterfaceRegistry* registry) override { | 48 service_manager::InterfaceRegistry* registry) override { |
50 registry->AddInterface<mash::mojom::Launchable>(this); | 49 registry->AddInterface<mash::mojom::Launchable>(this); |
51 return true; | 50 return true; |
52 } | 51 } |
53 | 52 |
54 // mash::mojom::Launchable: | 53 // mash::mojom::Launchable: |
55 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 54 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
56 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, | 55 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, |
(...skipping 12 matching lines...) Expand all Loading... |
69 std::unique_ptr<views::AuraInit> aura_init_; | 68 std::unique_ptr<views::AuraInit> aura_init_; |
70 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 69 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
71 | 70 |
72 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 71 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
73 }; | 72 }; |
74 | 73 |
75 MojoResult ServiceMain(MojoHandle service_request_handle) { | 74 MojoResult ServiceMain(MojoHandle service_request_handle) { |
76 return service_manager::ServiceRunner(new ViewsExamples) | 75 return service_manager::ServiceRunner(new ViewsExamples) |
77 .Run(service_request_handle); | 76 .Run(service_request_handle); |
78 } | 77 } |
OLD | NEW |