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

Side by Side Diff: chrome/browser/ui/ash/session_controller_client.cc

Issue 2911493002: cros: Pull user info from session_controller_client.mojom into separate mojom. (Closed)
Patch Set: Fix ordering in typemaps Created 3 years, 6 months 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 "chrome/browser/ui/ash/session_controller_client.h" 5 #include "chrome/browser/ui/ash/session_controller_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/public/cpp/session_types.h" 10 #include "ash/public/cpp/session_types.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Creates a mojom::UserSession for the given user. Returns nullptr if there is 62 // Creates a mojom::UserSession for the given user. Returns nullptr if there is
63 // no user session started for the given user. 63 // no user session started for the given user.
64 ash::mojom::UserSessionPtr UserToUserSession(const User& user) { 64 ash::mojom::UserSessionPtr UserToUserSession(const User& user) {
65 const uint32_t user_session_id = GetSessionId(user); 65 const uint32_t user_session_id = GetSessionId(user);
66 if (user_session_id == 0u) 66 if (user_session_id == 0u)
67 return nullptr; 67 return nullptr;
68 68
69 ash::mojom::UserSessionPtr session = ash::mojom::UserSession::New(); 69 ash::mojom::UserSessionPtr session = ash::mojom::UserSession::New();
70 session->session_id = user_session_id; 70 session->session_id = user_session_id;
71 session->type = user.GetType(); 71 session->user_info = ash::mojom::UserInfo::New();
72 session->account_id = user.GetAccountId(); 72 session->user_info->type = user.GetType();
73 session->display_name = base::UTF16ToUTF8(user.display_name()); 73 session->user_info->account_id = user.GetAccountId();
74 session->display_email = user.display_email(); 74 session->user_info->display_name = base::UTF16ToUTF8(user.display_name());
75 session->user_info->display_email = user.display_email();
75 76
76 session->avatar = user.GetImage(); 77 session->user_info->avatar = user.GetImage();
77 if (session->avatar.isNull()) { 78 if (session->user_info->avatar.isNull()) {
78 session->avatar = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 79 session->user_info->avatar =
79 IDR_PROFILE_PICTURE_LOADING); 80 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
81 IDR_PROFILE_PICTURE_LOADING);
80 } 82 }
81 83
82 if (user.IsSupervised()) { 84 if (user.IsSupervised()) {
83 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(&user); 85 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(&user);
84 if (profile) { 86 if (profile) {
85 SupervisedUserService* service = 87 SupervisedUserService* service =
86 SupervisedUserServiceFactory::GetForProfile(profile); 88 SupervisedUserServiceFactory::GetForProfile(profile);
87 session->custodian_email = service->GetCustodianEmailAddress(); 89 session->custodian_email = service->GetCustodianEmailAddress();
88 session->second_custodian_email = 90 session->second_custodian_email =
89 service->GetSecondCustodianEmailAddress(); 91 service->GetSecondCustodianEmailAddress();
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 const UserList logged_in_users = user_manager->GetLoggedInUsers(); 453 const UserList logged_in_users = user_manager->GetLoggedInUsers();
452 std::vector<uint32_t> user_session_ids; 454 std::vector<uint32_t> user_session_ids;
453 for (auto* user : user_manager->GetLRULoggedInUsers()) { 455 for (auto* user : user_manager->GetLRULoggedInUsers()) {
454 const uint32_t user_session_id = GetSessionId(*user); 456 const uint32_t user_session_id = GetSessionId(*user);
455 DCHECK_NE(0u, user_session_id); 457 DCHECK_NE(0u, user_session_id);
456 user_session_ids.push_back(user_session_id); 458 user_session_ids.push_back(user_session_id);
457 } 459 }
458 460
459 session_controller_->SetUserSessionOrder(user_session_ids); 461 session_controller_->SetUserSessionOrder(user_session_ids);
460 } 462 }
OLDNEW
« no previous file with comments | « ash/test/test_session_controller_client.cc ('k') | chrome/browser/ui/ash/session_controller_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698