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 : connector_(nullptr) {} | 18 : connector_(nullptr) {} |
19 Init::~Init() {} | 19 Init::~Init() {} |
20 | 20 |
21 void Init::Initialize(shell::Connector* connector, | 21 void Init::OnStart(shell::Connector* connector, |
22 const shell::Identity& identity, | 22 const shell::Identity& identity, |
23 uint32_t id) { | 23 uint32_t id) { |
24 connector_ = connector; | 24 connector_ = connector; |
25 connector_->Connect("mojo:ui"); | 25 connector_->Connect("mojo:ui"); |
26 StartTracing(); | 26 StartTracing(); |
27 StartLogin(); | 27 StartLogin(); |
28 } | 28 } |
29 | 29 |
30 bool Init::AcceptConnection(shell::Connection* connection) { | 30 bool Init::OnConnect(shell::Connection* connection) { |
31 connection->AddInterface<mojom::Init>(this); | 31 connection->AddInterface<mojom::Init>(this); |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 void Init::StartService(const mojo::String& name, | 35 void Init::StartService(const mojo::String& name, |
36 const mojo::String& user_id) { | 36 const mojo::String& user_id) { |
37 if (user_services_.find(user_id) == user_services_.end()) { | 37 if (user_services_.find(user_id) == user_services_.end()) { |
38 shell::Connector::ConnectParams params(shell::Identity(name, user_id)); | 38 shell::Connector::ConnectParams params(shell::Identity(name, user_id)); |
39 std::unique_ptr<shell::Connection> connection = | 39 std::unique_ptr<shell::Connection> connection = |
40 connector_->Connect(¶ms); | 40 connector_->Connect(¶ms); |
(...skipping 26 matching lines...) Expand all Loading... |
67 void Init::StartLogin() { | 67 void Init::StartLogin() { |
68 login_connection_ = connector_->Connect("mojo:login"); | 68 login_connection_ = connector_->Connect("mojo:login"); |
69 login_connection_->AddInterface<mojom::Init>(this); | 69 login_connection_->AddInterface<mojom::Init>(this); |
70 mash::login::mojom::LoginPtr login; | 70 mash::login::mojom::LoginPtr login; |
71 login_connection_->GetInterface(&login); | 71 login_connection_->GetInterface(&login); |
72 login->ShowLoginUI(); | 72 login->ShowLoginUI(); |
73 } | 73 } |
74 | 74 |
75 } // namespace init | 75 } // namespace init |
76 } // namespace main | 76 } // namespace main |
OLD | NEW |