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

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

Issue 2435153004: Change Service contract to pass ServiceInfo instead of Identity (Closed)
Patch Set: . Created 4 years, 1 month 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 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "mash/public/interfaces/launchable.mojom.h" 8 #include "mash/public/interfaces/launchable.mojom.h"
9 #include "mojo/public/cpp/bindings/binding_set.h" 9 #include "mojo/public/cpp/bindings/binding_set.h"
10 #include "services/service_manager/public/c/main.h" 10 #include "services/service_manager/public/c/main.h"
(...skipping 15 matching lines...) Expand all
26 class ViewsExamples 26 class ViewsExamples
27 : public service_manager::Service, 27 : public service_manager::Service,
28 public mash::mojom::Launchable, 28 public mash::mojom::Launchable,
29 public service_manager::InterfaceFactory<mash::mojom::Launchable> { 29 public service_manager::InterfaceFactory<mash::mojom::Launchable> {
30 public: 30 public:
31 ViewsExamples() {} 31 ViewsExamples() {}
32 ~ViewsExamples() override {} 32 ~ViewsExamples() override {}
33 33
34 private: 34 private:
35 // service_manager::Service: 35 // service_manager::Service:
36 void OnStart(const service_manager::Identity& identity) override { 36 void OnStart(const service_manager::ServiceInfo& info) override {
37 tracing_.Initialize(connector(), identity.name()); 37 tracing_.Initialize(connector(), info.identity.name());
38 aura_init_.reset( 38 aura_init_.reset(
39 new views::AuraInit(connector(), "views_mus_resources.pak")); 39 new views::AuraInit(connector(), "views_mus_resources.pak"));
40 window_manager_connection_ = 40 window_manager_connection_ =
41 views::WindowManagerConnection::Create(connector(), identity); 41 views::WindowManagerConnection::Create(connector(), info.identity);
42 } 42 }
43 bool OnConnect(const service_manager::Identity& remote_identity, 43 bool OnConnect(const service_manager::ServiceInfo& remote_info,
44 service_manager::InterfaceRegistry* registry) override { 44 service_manager::InterfaceRegistry* registry) override {
45 registry->AddInterface<mash::mojom::Launchable>(this); 45 registry->AddInterface<mash::mojom::Launchable>(this);
46 return true; 46 return true;
47 } 47 }
48 48
49 // mash::mojom::Launchable: 49 // mash::mojom::Launchable:
50 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { 50 void Launch(uint32_t what, mash::mojom::LaunchMode how) override {
51 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE, 51 views::examples::ShowExamplesWindow(views::examples::QUIT_ON_CLOSE,
52 nullptr, nullptr); 52 nullptr, nullptr);
53 } 53 }
(...skipping 10 matching lines...) Expand all
64 std::unique_ptr<views::AuraInit> aura_init_; 64 std::unique_ptr<views::AuraInit> aura_init_;
65 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; 65 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_;
66 66
67 DISALLOW_COPY_AND_ASSIGN(ViewsExamples); 67 DISALLOW_COPY_AND_ASSIGN(ViewsExamples);
68 }; 68 };
69 69
70 MojoResult ServiceMain(MojoHandle service_request_handle) { 70 MojoResult ServiceMain(MojoHandle service_request_handle) {
71 return service_manager::ServiceRunner(new ViewsExamples) 71 return service_manager::ServiceRunner(new ViewsExamples)
72 .Run(service_request_handle); 72 .Run(service_request_handle);
73 } 73 }
OLDNEW
« no previous file with comments | « mash/catalog_viewer/catalog_viewer.cc ('k') | mash/example/window_type_launcher/window_type_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698