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 "mash/init/init.h" | 5 #include "mash/init/init.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "mash/login/public/interfaces/login.mojom.h" | 10 #include "mash/login/public/interfaces/login.mojom.h" |
11 #include "services/shell/public/cpp/connection.h" | 11 #include "services/shell/public/cpp/connection.h" |
12 #include "services/shell/public/cpp/connector.h" | 12 #include "services/shell/public/cpp/connector.h" |
13 | 13 |
14 namespace mash { | 14 namespace mash { |
15 namespace init { | 15 namespace init { |
16 | 16 |
17 Init::Init() {} | 17 Init::Init() {} |
18 Init::~Init() {} | 18 Init::~Init() {} |
19 | 19 |
20 void Init::OnStart(const shell::Identity& identity) { | 20 void Init::OnStart(const shell::Identity& identity) { |
21 connector()->Connect("mojo:ui"); | 21 connector()->Connect("mojo:ui"); |
22 StartTracing(); | 22 StartTracing(); |
23 StartLogin(); | 23 StartLogin(); |
24 } | 24 } |
25 | 25 |
26 bool Init::OnConnect(shell::Connection* connection) { | 26 bool Init::OnConnect(const shell::Identity& remote_identity, |
27 connection->AddInterface<mojom::Init>(this); | 27 shell::InterfaceRegistry* registry) { |
| 28 registry->AddInterface<mojom::Init>(this); |
28 return true; | 29 return true; |
29 } | 30 } |
30 | 31 |
31 void Init::StartService(const mojo::String& name, | 32 void Init::StartService(const mojo::String& name, |
32 const mojo::String& user_id) { | 33 const mojo::String& user_id) { |
33 if (user_services_.find(user_id) == user_services_.end()) { | 34 if (user_services_.find(user_id) == user_services_.end()) { |
34 shell::Connector::ConnectParams params(shell::Identity(name, user_id)); | 35 shell::Connector::ConnectParams params(shell::Identity(name, user_id)); |
35 std::unique_ptr<shell::Connection> connection = | 36 std::unique_ptr<shell::Connection> connection = |
36 connector()->Connect(¶ms); | 37 connector()->Connect(¶ms); |
37 connection->SetConnectionLostClosure( | 38 connection->SetConnectionLostClosure( |
(...skipping 25 matching lines...) Expand all Loading... |
63 | 64 |
64 void Init::StartLogin() { | 65 void Init::StartLogin() { |
65 login_connection_ = connector()->Connect("mojo:login"); | 66 login_connection_ = connector()->Connect("mojo:login"); |
66 mash::login::mojom::LoginPtr login; | 67 mash::login::mojom::LoginPtr login; |
67 login_connection_->GetInterface(&login); | 68 login_connection_->GetInterface(&login); |
68 login->ShowLoginUI(); | 69 login->ShowLoginUI(); |
69 } | 70 } |
70 | 71 |
71 } // namespace init | 72 } // namespace init |
72 } // namespace main | 73 } // namespace main |
OLD | NEW |