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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "chromeos/chromeos_switches.h" | 10 #include "chromeos/chromeos_switches.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
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::SetLoggedInStateAndPrimaryUser( |
| 61 LoggedInState state, |
| 62 LoggedInUserType type, |
| 63 const std::string& primary_user_hash) { |
| 64 DCHECK(type != LOGGED_IN_USER_NONE); |
| 65 primary_user_hash_ = primary_user_hash; |
| 66 VLOG(1) << "LoggedInStateUser: " << primary_user_hash; |
| 67 SetLoggedInState(state, type); |
| 68 } |
| 69 |
60 void LoginState::SetLoggedInState(LoggedInState state, | 70 void LoginState::SetLoggedInState(LoggedInState state, |
61 LoggedInUserType type) { | 71 LoggedInUserType type) { |
62 if (state == logged_in_state_ && type == logged_in_user_type_) | 72 if (state == logged_in_state_ && type == logged_in_user_type_) |
63 return; | 73 return; |
64 VLOG(1) << "LoggedInState: " << state << " UserType: " << type; | 74 VLOG(1) << "LoggedInState: " << state << " UserType: " << type; |
65 logged_in_state_ = state; | 75 logged_in_state_ = state; |
66 logged_in_user_type_ = type; | 76 logged_in_user_type_ = type; |
67 NotifyObservers(); | 77 NotifyObservers(); |
68 } | 78 } |
69 | 79 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 142 |
133 LoginState::~LoginState() { | 143 LoginState::~LoginState() { |
134 } | 144 } |
135 | 145 |
136 void LoginState::NotifyObservers() { | 146 void LoginState::NotifyObservers() { |
137 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, | 147 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, |
138 LoggedInStateChanged()); | 148 LoggedInStateChanged()); |
139 } | 149 } |
140 | 150 |
141 } // namespace chromeos | 151 } // namespace chromeos |
OLD | NEW |