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

Side by Side Diff: chromeos/login/login_state.cc

Issue 24072006: Return correct window when user is logged in but before session is started. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test compile error Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void LoginState::SetLoggedInState(LoggedInState state, 60 void LoginState::SetLoggedInState(LoggedInState state,
61 LoggedInUserType type) { 61 LoggedInUserType type) {
62 if (state == logged_in_state_ && type == logged_in_user_type_) 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 void LoginState::SetSessionStarted(bool session_started) {
71 DCHECK(GetLoggedInState() == LOGGED_IN_ACTIVE);
72 session_started_ = session_started;
73 }
74
70 LoginState::LoggedInState LoginState::GetLoggedInState() const { 75 LoginState::LoggedInState LoginState::GetLoggedInState() const {
71 if (AlwaysLoggedIn()) 76 if (AlwaysLoggedIn())
72 return LOGGED_IN_ACTIVE; 77 return LOGGED_IN_ACTIVE;
73 return logged_in_state_; 78 return logged_in_state_;
74 } 79 }
75 80
76 LoginState::LoggedInUserType LoginState::GetLoggedInUserType() const { 81 LoginState::LoggedInUserType LoginState::GetLoggedInUserType() const {
77 return logged_in_user_type_; 82 return logged_in_user_type_;
78 } 83 }
79 84
(...skipping 26 matching lines...) Expand all
106 type == chromeos::LoginState::LOGGED_IN_USER_OWNER || 111 type == chromeos::LoginState::LOGGED_IN_USER_OWNER ||
107 type == chromeos::LoginState::LOGGED_IN_USER_LOCALLY_MANAGED; 112 type == chromeos::LoginState::LOGGED_IN_USER_LOCALLY_MANAGED;
108 } 113 }
109 114
110 bool LoginState::IsUserGaiaAuthenticated() const { 115 bool LoginState::IsUserGaiaAuthenticated() const {
111 LoggedInUserType type = logged_in_user_type_; 116 LoggedInUserType type = logged_in_user_type_;
112 return type == chromeos::LoginState::LOGGED_IN_USER_REGULAR || 117 return type == chromeos::LoginState::LOGGED_IN_USER_REGULAR ||
113 type == chromeos::LoginState::LOGGED_IN_USER_OWNER; 118 type == chromeos::LoginState::LOGGED_IN_USER_OWNER;
114 } 119 }
115 120
121 bool LoginState::IsSessionStarted() const {
122 return session_started_;
123 }
124
116 // Private methods 125 // Private methods
117 126
118 LoginState::LoginState() : logged_in_state_(LOGGED_IN_OOBE), 127 LoginState::LoginState() : logged_in_state_(LOGGED_IN_OOBE),
119 logged_in_user_type_(LOGGED_IN_USER_NONE) { 128 logged_in_user_type_(LOGGED_IN_USER_NONE),
129 session_started_(false) {
120 } 130 }
121 131
122 LoginState::~LoginState() { 132 LoginState::~LoginState() {
123 } 133 }
124 134
125 void LoginState::NotifyObservers() { 135 void LoginState::NotifyObservers() {
126 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, 136 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_,
127 LoggedInStateChanged(GetLoggedInState())); 137 LoggedInStateChanged(GetLoggedInState()));
128 } 138 }
129 139
130 } // namespace chromeos 140 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698