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/login/login.h" | 5 #include "mash/login/login.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/public/interfaces/container.mojom.h" | 10 #include "ash/public/interfaces/container.mojom.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 login_button_1_->SetBounds(button_box.x(), button_box.y(), ps1.width(), | 104 login_button_1_->SetBounds(button_box.x(), button_box.y(), ps1.width(), |
105 ps1.height()); | 105 ps1.height()); |
106 login_button_2_->SetBounds(login_button_1_->bounds().right() + 10, | 106 login_button_2_->SetBounds(login_button_1_->bounds().right() + 10, |
107 button_box.y(), ps2.width(), ps2.height()); | 107 button_box.y(), ps2.width(), ps2.height()); |
108 } | 108 } |
109 | 109 |
110 // Overridden from views::ButtonListener: | 110 // Overridden from views::ButtonListener: |
111 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 111 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
112 | 112 |
113 void StartWindowManager(const shell::Identity& identity) { | 113 void StartWindowManager(const shell::Identity& identity) { |
114 mash_wm_connection_ = connector_->Connect("mojo:ash"); | 114 mash_wm_connection_ = connector_->Connect("service:ash"); |
115 mash_wm_connection_->SetConnectionLostClosure( | 115 mash_wm_connection_->SetConnectionLostClosure( |
116 base::Bind(&UI::StartWindowManager, base::Unretained(this), identity)); | 116 base::Bind(&UI::StartWindowManager, base::Unretained(this), identity)); |
117 window_manager_connection_ = | 117 window_manager_connection_ = |
118 views::WindowManagerConnection::Create(connector_, identity); | 118 views::WindowManagerConnection::Create(connector_, identity); |
119 } | 119 } |
120 | 120 |
121 Login* login_; | 121 Login* login_; |
122 shell::Connector* connector_; | 122 shell::Connector* connector_; |
123 const std::string user_id_1_; | 123 const std::string user_id_1_; |
124 const std::string user_id_2_; | 124 const std::string user_id_2_; |
125 views::MdTextButton* login_button_1_; | 125 views::MdTextButton* login_button_1_; |
126 views::MdTextButton* login_button_2_; | 126 views::MdTextButton* login_button_2_; |
127 std::unique_ptr<shell::Connection> mash_wm_connection_; | 127 std::unique_ptr<shell::Connection> mash_wm_connection_; |
128 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 128 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(UI); | 130 DISALLOW_COPY_AND_ASSIGN(UI); |
131 }; | 131 }; |
132 | 132 |
133 class Login : public shell::Service, | 133 class Login : public shell::Service, |
134 public shell::InterfaceFactory<mojom::Login>, | 134 public shell::InterfaceFactory<mojom::Login>, |
135 public mojom::Login { | 135 public mojom::Login { |
136 public: | 136 public: |
137 Login() {} | 137 Login() {} |
138 ~Login() override {} | 138 ~Login() override {} |
139 | 139 |
140 void LoginAs(const std::string& user_id) { | 140 void LoginAs(const std::string& user_id) { |
141 user_access_manager_->SetActiveUser(user_id); | 141 user_access_manager_->SetActiveUser(user_id); |
142 mash::init::mojom::InitPtr init; | 142 mash::init::mojom::InitPtr init; |
143 connector()->ConnectToInterface("mojo:mash_init", &init); | 143 connector()->ConnectToInterface("service:mash_init", &init); |
144 init->StartService("mojo:mash_session", user_id); | 144 init->StartService("service:mash_session", user_id); |
145 } | 145 } |
146 | 146 |
147 private: | 147 private: |
148 // shell::Service: | 148 // shell::Service: |
149 void OnStart(const shell::Identity& identity) override { | 149 void OnStart(const shell::Identity& identity) override { |
150 identity_ = identity; | 150 identity_ = identity; |
151 tracing_.Initialize(connector(), identity.name()); | 151 tracing_.Initialize(connector(), identity.name()); |
152 | 152 |
153 aura_init_.reset( | 153 aura_init_.reset( |
154 new views::AuraInit(connector(), "views_mus_resources.pak")); | 154 new views::AuraInit(connector(), "views_mus_resources.pak")); |
155 | 155 |
156 connector()->ConnectToInterface("mojo:ui", &user_access_manager_); | 156 connector()->ConnectToInterface("service:ui", &user_access_manager_); |
157 user_access_manager_->SetActiveUser(identity.user_id()); | 157 user_access_manager_->SetActiveUser(identity.user_id()); |
158 } | 158 } |
159 bool OnConnect(const shell::Identity& remote_identity, | 159 bool OnConnect(const shell::Identity& remote_identity, |
160 shell::InterfaceRegistry* registry) override { | 160 shell::InterfaceRegistry* registry) override { |
161 registry->AddInterface<mojom::Login>(this); | 161 registry->AddInterface<mojom::Login>(this); |
162 return true; | 162 return true; |
163 } | 163 } |
164 | 164 |
165 // shell::InterfaceFactory<mojom::Login>: | 165 // shell::InterfaceFactory<mojom::Login>: |
166 void Create(const shell::Identity& remote_identity, | 166 void Create(const shell::Identity& remote_identity, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 } // namespace | 202 } // namespace |
203 | 203 |
204 shell::Service* CreateLogin() { | 204 shell::Service* CreateLogin() { |
205 return new Login; | 205 return new Login; |
206 } | 206 } |
207 | 207 |
208 } // namespace login | 208 } // namespace login |
209 } // namespace main | 209 } // namespace main |
OLD | NEW |