Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: mash/example/views_examples/views_examples.cc

Issue 2967943002: Update AuraInit to handle failed initialization (Closed)
Patch Set: Switch to a Create method for AuraInit Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « mash/catalog_viewer/catalog_viewer.cc ('k') | mash/example/window_type_launcher/window_type_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698