| 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 "ash/common/session/session_controller.h" | 5 #include "ash/common/session/session_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void SetSessionInfo(const mojom::SessionInfo& info) { | 86 void SetSessionInfo(const mojom::SessionInfo& info) { |
| 87 mojom::SessionInfoPtr info_ptr = mojom::SessionInfo::New(); | 87 mojom::SessionInfoPtr info_ptr = mojom::SessionInfo::New(); |
| 88 *info_ptr = info; | 88 *info_ptr = info; |
| 89 controller_->SetSessionInfo(std::move(info_ptr)); | 89 controller_->SetSessionInfo(std::move(info_ptr)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void UpdateSession(uint32_t session_id, const std::string& email) { | 92 void UpdateSession(uint32_t session_id, const std::string& email) { |
| 93 mojom::UserSessionPtr session = mojom::UserSession::New(); | 93 mojom::UserSessionPtr session = mojom::UserSession::New(); |
| 94 session->session_id = session_id; | 94 session->session_id = session_id; |
| 95 session->type = user_manager::USER_TYPE_REGULAR; | 95 session->type = user_manager::USER_TYPE_REGULAR; |
| 96 session->serialized_account_id = | 96 session->account_id = AccountId::FromUserEmail(email); |
| 97 AccountId::FromUserEmail(email).Serialize(); | |
| 98 session->display_name = email; | 97 session->display_name = email; |
| 99 session->display_email = email; | 98 session->display_email = email; |
| 100 | 99 |
| 101 controller_->UpdateUserSession(std::move(session)); | 100 controller_->UpdateUserSession(std::move(session)); |
| 102 } | 101 } |
| 103 | 102 |
| 104 std::string GetUserSessionEmails() const { | 103 std::string GetUserSessionEmails() const { |
| 105 std::string emails; | 104 std::string emails; |
| 106 for (const auto& session : controller_->GetUserSessions()) { | 105 for (const auto& session : controller_->GetUserSessions()) { |
| 107 emails += session->display_email + ","; | 106 emails += session->display_email + ","; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 EXPECT_EQ("user2@test.com", observer()->active_account_id().GetUserEmail()); | 227 EXPECT_EQ("user2@test.com", observer()->active_account_id().GetUserEmail()); |
| 229 | 228 |
| 230 order = {1u, 2u}; | 229 order = {1u, 2u}; |
| 231 controller()->SetUserSessionOrder(order); | 230 controller()->SetUserSessionOrder(order); |
| 232 EXPECT_EQ("user1@test.com,user2@test.com,", GetUserSessionEmails()); | 231 EXPECT_EQ("user1@test.com,user2@test.com,", GetUserSessionEmails()); |
| 233 EXPECT_EQ("user1@test.com", observer()->active_account_id().GetUserEmail()); | 232 EXPECT_EQ("user1@test.com", observer()->active_account_id().GetUserEmail()); |
| 234 } | 233 } |
| 235 | 234 |
| 236 } // namespace | 235 } // namespace |
| 237 } // namespace ash | 236 } // namespace ash |
| OLD | NEW |