| 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 <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "ash/common/login_status.h" | 9 #include "ash/common/login_status.h" | 
| 10 #include "ash/common/session/session_state_observer.h" | 10 #include "ash/common/session/session_state_observer.h" | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 167       std::find_if(user_sessions_.begin(), user_sessions_.end(), | 167       std::find_if(user_sessions_.begin(), user_sessions_.end(), | 
| 168                    [&user_session](const mojom::UserSessionPtr& session) { | 168                    [&user_session](const mojom::UserSessionPtr& session) { | 
| 169                      return session->session_id == user_session->session_id; | 169                      return session->session_id == user_session->session_id; | 
| 170                    }); | 170                    }); | 
| 171   if (it == user_sessions_.end()) { | 171   if (it == user_sessions_.end()) { | 
| 172     AddUserSession(std::move(user_session)); | 172     AddUserSession(std::move(user_session)); | 
| 173     return; | 173     return; | 
| 174   } | 174   } | 
| 175 | 175 | 
| 176   *it = std::move(user_session); | 176   *it = std::move(user_session); | 
| 177   // TODO(xiyuan): Notify observers about meta change to replace things such as | 177   for (auto& observer : observers_) | 
| 178   //     NOTIFICATION_LOGIN_USER_IMAGE_CHANGED. http://crbug.com/670422 | 178     observer.UserSessionUpdated((*it)->account_id); | 
| 179 } | 179 } | 
| 180 | 180 | 
| 181 void SessionController::SetUserSessionOrder( | 181 void SessionController::SetUserSessionOrder( | 
| 182     const std::vector<uint32_t>& user_session_order) { | 182     const std::vector<uint32_t>& user_session_order) { | 
| 183   DCHECK_EQ(user_sessions_.size(), user_session_order.size()); | 183   DCHECK_EQ(user_sessions_.size(), user_session_order.size()); | 
| 184 | 184 | 
| 185   // Adjusts |user_sessions_| to match the given order. | 185   // Adjusts |user_sessions_| to match the given order. | 
| 186   std::vector<mojom::UserSessionPtr> sessions; | 186   std::vector<mojom::UserSessionPtr> sessions; | 
| 187   for (const auto& session_id : user_session_order) { | 187   for (const auto& session_id : user_session_order) { | 
| 188     auto it = | 188     auto it = | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 267     case user_manager::NUM_USER_TYPES: | 267     case user_manager::NUM_USER_TYPES: | 
| 268       // Avoid having a "default" case so the compiler catches new enum values. | 268       // Avoid having a "default" case so the compiler catches new enum values. | 
| 269       NOTREACHED(); | 269       NOTREACHED(); | 
| 270       return LoginStatus::USER; | 270       return LoginStatus::USER; | 
| 271   } | 271   } | 
| 272   NOTREACHED(); | 272   NOTREACHED(); | 
| 273   return LoginStatus::USER; | 273   return LoginStatus::USER; | 
| 274 } | 274 } | 
| 275 | 275 | 
| 276 }  // namespace ash | 276 }  // namespace ash | 
| OLD | NEW | 
|---|