| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chromeos/login/login_state.h" | 5 #include "chromeos/login/login_state.h" |
| 6 | 6 |
| 7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chromeos/chromeos_switches.h" | 10 #include "chromeos/chromeos_switches.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void LoginState::AddObserver(Observer* observer) { | 52 void LoginState::AddObserver(Observer* observer) { |
| 53 observer_list_.AddObserver(observer); | 53 observer_list_.AddObserver(observer); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void LoginState::RemoveObserver(Observer* observer) { | 56 void LoginState::RemoveObserver(Observer* observer) { |
| 57 observer_list_.RemoveObserver(observer); | 57 observer_list_.RemoveObserver(observer); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void LoginState::SetLoggedInState(LoggedInState state, | 60 void LoginState::SetLoggedInState(LoggedInState state, |
| 61 LoggedInUserType type) { | 61 LoggedInUserType type) { |
| 62 if (state == logged_in_state_) | 62 if (state == logged_in_state_ && type == logged_in_user_type_) |
| 63 return; | 63 return; |
| 64 VLOG(1) << "LoggedInState: " << state << " UserType: " << type; | 64 VLOG(1) << "LoggedInState: " << state << " UserType: " << type; |
| 65 logged_in_state_ = state; | 65 logged_in_state_ = state; |
| 66 logged_in_user_type_ = type; | 66 logged_in_user_type_ = type; |
| 67 NotifyObservers(); | 67 NotifyObservers(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 LoginState::LoggedInState LoginState::GetLoggedInState() const { | 70 LoginState::LoggedInState LoginState::GetLoggedInState() const { |
| 71 if (AlwaysLoggedIn()) | 71 if (AlwaysLoggedIn()) |
| 72 return LOGGED_IN_ACTIVE; | 72 return LOGGED_IN_ACTIVE; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 LoginState::~LoginState() { | 122 LoginState::~LoginState() { |
| 123 } | 123 } |
| 124 | 124 |
| 125 void LoginState::NotifyObservers() { | 125 void LoginState::NotifyObservers() { |
| 126 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, | 126 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, |
| 127 LoggedInStateChanged(GetLoggedInState())); | 127 LoggedInStateChanged(GetLoggedInState())); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace chromeos | 130 } // namespace chromeos |
| OLD | NEW |