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_ = base::MakeUnique<views::AuraInit>( | 34 aura_init_ = |
35 context()->connector(), context()->identity(), | 35 views::AuraInit::Create(context()->connector(), context()->identity(), |
36 "views_mus_resources.pak", std::string(), nullptr, | 36 "views_mus_resources.pak", std::string(), |
37 views::AuraInit::Mode::AURA_MUS); | 37 nullptr, views::AuraInit::Mode::AURA_MUS); |
| 38 if (!aura_init_) |
| 39 context()->QuitNow(); |
38 } | 40 } |
39 void OnBindInterface(const service_manager::BindSourceInfo& source_info, | 41 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
40 const std::string& interface_name, | 42 const std::string& interface_name, |
41 mojo::ScopedMessagePipeHandle interface_pipe) override { | 43 mojo::ScopedMessagePipeHandle interface_pipe) override { |
42 registry_.BindInterface(source_info, interface_name, | 44 registry_.BindInterface(source_info, interface_name, |
43 std::move(interface_pipe)); | 45 std::move(interface_pipe)); |
44 } | 46 } |
45 | 47 |
46 // mash::mojom::Launchable: | 48 // mash::mojom::Launchable: |
47 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 49 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
(...skipping 11 matching lines...) Expand all Loading... |
59 | 61 |
60 std::unique_ptr<views::AuraInit> aura_init_; | 62 std::unique_ptr<views::AuraInit> aura_init_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); | 64 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); |
63 }; | 65 }; |
64 | 66 |
65 MojoResult ServiceMain(MojoHandle service_request_handle) { | 67 MojoResult ServiceMain(MojoHandle service_request_handle) { |
66 return service_manager::ServiceRunner(new ViewsExamples) | 68 return service_manager::ServiceRunner(new ViewsExamples) |
67 .Run(service_request_handle); | 69 .Run(service_request_handle); |
68 } | 70 } |
OLD | NEW |