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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc

Issue 143873012: Add local state flag to force online login for a user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 if (!help_app_.get()) 1168 if (!help_app_.get())
1169 help_app_ = new HelpAppLauncher(GetNativeWindow()); 1169 help_app_ = new HelpAppLauncher(GetNativeWindow());
1170 help_app_->ShowHelpTopic( 1170 help_app_->ShowHelpTopic(
1171 static_cast<HelpAppLauncher::HelpTopic>(help_topic_id)); 1171 static_cast<HelpAppLauncher::HelpTopic>(help_topic_id));
1172 } 1172 }
1173 1173
1174 void SigninScreenHandler::FillUserDictionary(User* user, 1174 void SigninScreenHandler::FillUserDictionary(User* user,
1175 bool is_owner, 1175 bool is_owner,
1176 base::DictionaryValue* user_dict) { 1176 base::DictionaryValue* user_dict) {
1177 const std::string& email = user->email(); 1177 const std::string& email = user->email();
1178 bool is_public_account = 1178 const bool is_public_account =
1179 user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT; 1179 user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT;
1180 bool is_locally_managed_user = 1180 const bool is_locally_managed_user =
1181 user->GetType() == User::USER_TYPE_LOCALLY_MANAGED; 1181 user->GetType() == User::USER_TYPE_LOCALLY_MANAGED;
1182 const User::OAuthTokenStatus token_status = user->oauth_token_status(); 1182 const User::OAuthTokenStatus token_status = user->oauth_token_status();
1183 1183
1184 // Allow offline sign-in if the oauth token is valid. For supervised users, 1184 // Force online sign-in if at least one of the following is true:
1185 // allow offline sign-in if the token status is unknown as well. The token 1185 // * The flag to force online sign-in is set for the user.
1186 // will be invalidated inside the session in case it has been revoked. 1186 // * The user's oauth token is invalid.
1187 const bool allow_offline_signin = 1187 // * The user's oauth token status is unknown. This condition does not apply
1188 token_status == User::OAUTH2_TOKEN_STATUS_VALID || 1188 // to supervised users: A supervised user whose oauth token status is
1189 (is_locally_managed_user && 1189 // unknown may still log in offline. The token will be invalidated inside
1190 // the session in case it has been revoked.
1191 const bool force_online_signin =
1192 user->force_online_signin() ||
1193 (token_status == User::OAUTH2_TOKEN_STATUS_INVALID) ||
1194 (!is_locally_managed_user &&
1190 token_status == User::OAUTH_TOKEN_STATUS_UNKNOWN); 1195 token_status == User::OAUTH_TOKEN_STATUS_UNKNOWN);
1191 1196
1192 user_dict->SetString(kKeyUsername, email); 1197 user_dict->SetString(kKeyUsername, email);
1193 user_dict->SetString(kKeyEmailAddress, user->display_email()); 1198 user_dict->SetString(kKeyEmailAddress, user->display_email());
1194 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); 1199 user_dict->SetString(kKeyDisplayName, user->GetDisplayName());
1195 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); 1200 user_dict->SetBoolean(kKeyPublicAccount, is_public_account);
1196 user_dict->SetBoolean(kKeyLocallyManagedUser, is_locally_managed_user); 1201 user_dict->SetBoolean(kKeyLocallyManagedUser, is_locally_managed_user);
1197 user_dict->SetInteger(kKeyForceOnlineSignin, !allow_offline_signin); 1202 user_dict->SetInteger(kKeyForceOnlineSignin, force_online_signin);
1198 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); 1203 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in());
1199 user_dict->SetBoolean(kKeyIsOwner, is_owner); 1204 user_dict->SetBoolean(kKeyIsOwner, is_owner);
1200 1205
1201 if (is_public_account) { 1206 if (is_public_account) {
1202 policy::BrowserPolicyConnectorChromeOS* policy_connector = 1207 policy::BrowserPolicyConnectorChromeOS* policy_connector =
1203 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1208 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1204 1209
1205 if (policy_connector->IsEnterpriseManaged()) { 1210 if (policy_connector->IsEnterpriseManaged()) {
1206 user_dict->SetString(kKeyEnterpriseDomain, 1211 user_dict->SetString(kKeyEnterpriseDomain,
1207 policy_connector->GetEnterpriseDomain()); 1212 policy_connector->GetEnterpriseDomain());
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 DCHECK(gaia_screen_handler_); 1650 DCHECK(gaia_screen_handler_);
1646 return gaia_screen_handler_->frame_state(); 1651 return gaia_screen_handler_->frame_state();
1647 } 1652 }
1648 1653
1649 net::Error SigninScreenHandler::FrameError() const { 1654 net::Error SigninScreenHandler::FrameError() const {
1650 DCHECK(gaia_screen_handler_); 1655 DCHECK(gaia_screen_handler_);
1651 return gaia_screen_handler_->frame_error(); 1656 return gaia_screen_handler_->frame_error();
1652 } 1657 }
1653 1658
1654 } // namespace chromeos 1659 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698