| 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 "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" |
| 11 #include "ash/public/interfaces/constants.mojom.h" | 11 #include "ash/public/interfaces/constants.mojom.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/chromeos/login/user_flow.h" |
| 16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 15 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" | 20 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" |
| 19 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/grit/theme_resources.h" | 22 #include "chrome/grit/theme_resources.h" |
| 21 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "chromeos/dbus/session_manager_client.h" | 24 #include "chromeos/dbus/session_manager_client.h" |
| 23 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
| 24 #include "components/session_manager/core/session_manager.h" | 26 #include "components/session_manager/core/session_manager.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 session->account_id = user.GetAccountId(); | 63 session->account_id = user.GetAccountId(); |
| 62 session->display_name = base::UTF16ToUTF8(user.display_name()); | 64 session->display_name = base::UTF16ToUTF8(user.display_name()); |
| 63 session->display_email = user.display_email(); | 65 session->display_email = user.display_email(); |
| 64 | 66 |
| 65 session->avatar = user.GetImage(); | 67 session->avatar = user.GetImage(); |
| 66 if (session->avatar.isNull()) { | 68 if (session->avatar.isNull()) { |
| 67 session->avatar = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 69 session->avatar = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 68 IDR_PROFILE_PICTURE_LOADING); | 70 IDR_PROFILE_PICTURE_LOADING); |
| 69 } | 71 } |
| 70 | 72 |
| 73 chromeos::UserFlow* const user_flow = |
| 74 chromeos::ChromeUserManager::Get()->GetUserFlow(user.GetAccountId()); |
| 75 session->should_enable_settings = user_flow->ShouldEnableSettings(); |
| 76 session->should_show_notification_tray = |
| 77 user_flow->ShouldShowNotificationTray(); |
| 78 |
| 71 return session; | 79 return session; |
| 72 } | 80 } |
| 73 | 81 |
| 74 void DoSwitchUser(const AccountId& account_id) { | 82 void DoSwitchUser(const AccountId& account_id) { |
| 75 UserManager::Get()->SwitchActiveUser(account_id); | 83 UserManager::Get()->SwitchActiveUser(account_id); |
| 76 } | 84 } |
| 77 | 85 |
| 78 } // namespace | 86 } // namespace |
| 79 | 87 |
| 80 SessionControllerClient::SessionControllerClient() : binding_(this) { | 88 SessionControllerClient::SessionControllerClient() : binding_(this) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 const UserList logged_in_users = user_manager->GetLoggedInUsers(); | 307 const UserList logged_in_users = user_manager->GetLoggedInUsers(); |
| 300 std::vector<uint32_t> user_session_ids; | 308 std::vector<uint32_t> user_session_ids; |
| 301 for (auto* user : user_manager->GetLRULoggedInUsers()) { | 309 for (auto* user : user_manager->GetLRULoggedInUsers()) { |
| 302 const uint32_t user_session_id = GetSessionId(*user); | 310 const uint32_t user_session_id = GetSessionId(*user); |
| 303 DCHECK_NE(0u, user_session_id); | 311 DCHECK_NE(0u, user_session_id); |
| 304 user_session_ids.push_back(user_session_id); | 312 user_session_ids.push_back(user_session_id); |
| 305 } | 313 } |
| 306 | 314 |
| 307 session_controller_->SetUserSessionOrder(user_session_ids); | 315 session_controller_->SetUserSessionOrder(user_session_ids); |
| 308 } | 316 } |
| OLD | NEW |