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 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "mash/public/interfaces/launchable.mojom.h" | 10 #include "mash/public/interfaces/launchable.mojom.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 ViewsExamples() { | 25 ViewsExamples() { |
26 registry_.AddInterface<mash::mojom::Launchable>( | 26 registry_.AddInterface<mash::mojom::Launchable>( |
27 base::Bind(&ViewsExamples::Create, base::Unretained(this))); | 27 base::Bind(&ViewsExamples::Create, base::Unretained(this))); |
28 } | 28 } |
29 ~ViewsExamples() override {} | 29 ~ViewsExamples() override {} |
30 | 30 |
31 private: | 31 private: |
32 // service_manager::Service: | 32 // service_manager::Service: |
33 void OnStart() override { | 33 void OnStart() override { |
34 aura_init_ = | 34 aura_init_ = base::MakeUnique<views::AuraInit>( |
35 views::AuraInit::Create(context()->connector(), context()->identity(), | 35 context()->connector(), context()->identity(), |
36 "views_mus_resources.pak", std::string(), | 36 "views_mus_resources.pak", std::string(), nullptr, |
37 nullptr, views::AuraInit::Mode::AURA_MUS); | 37 views::AuraInit::Mode::AURA_MUS); |
38 if (!aura_init_) | |
39 context()->QuitNow(); | |
40 } | 38 } |
41 void OnBindInterface(const service_manager::BindSourceInfo& source_info, | 39 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
42 const std::string& interface_name, | 40 const std::string& interface_name, |
43 mojo::ScopedMessagePipeHandle interface_pipe) override { | 41 mojo::ScopedMessagePipeHandle interface_pipe) override { |
44 registry_.BindInterface(source_info, interface_name, | 42 registry_.BindInterface(source_info, interface_name, |
45 std::move(interface_pipe)); | 43 std::move(interface_pipe)); |
46 } | 44 } |
47 | 45 |
48 // mash::mojom::Launchable: | 46 // mash::mojom::Launchable: |
49 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 47 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
(...skipping 11 matching lines...) Expand all Loading... |
61 | 59 |
62 std::unique_ptr<views::AuraInit> aura_init_; | 60 std::unique_ptr<views::AuraInit> aura_init_; |
63 | 61 |
64 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 62 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
65 }; | 63 }; |
66 | 64 |
67 MojoResult ServiceMain(MojoHandle service_request_handle) { | 65 MojoResult ServiceMain(MojoHandle service_request_handle) { |
68 return service_manager::ServiceRunner(new ViewsExamples) | 66 return service_manager::ServiceRunner(new ViewsExamples) |
69 .Run(service_request_handle); | 67 .Run(service_request_handle); |
70 } | 68 } |
OLD | NEW |