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

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

Issue 1066843002: Run OAuth token handle check upon user pod selction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/audio/sounds.h" 9 #include "ash/audio/sounds.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 OobeDisplay* oobe_display = GetOobeUI(); 623 OobeDisplay* oobe_display = GetOobeUI();
624 signin_screen_controller_.reset(new SignInScreenController( 624 signin_screen_controller_.reset(new SignInScreenController(
625 oobe_display, webui_login_display_->delegate())); 625 oobe_display, webui_login_display_->delegate()));
626 } 626 }
627 627
628 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); 628 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered();
629 SetOobeProgressBarVisible(oobe_progress_bar_visible_); 629 SetOobeProgressBarVisible(oobe_progress_bar_visible_);
630 SetStatusAreaVisible(true); 630 SetStatusAreaVisible(true);
631 existing_user_controller_->Init(users); 631 existing_user_controller_->Init(users);
632 632
633 // Validate user OAuth tokens.
634
635 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
636 switches::kEnableOAuthTokenHandlers)) {
637 token_handle_util_.reset(
638 new TokenHandleUtil(user_manager::UserManager::Get()));
639 for (auto* user : users) {
640 auto user_id = user->GetUserID();
641 if (token_handle_util_->HasToken(user_id)) {
642 token_handle_util_->CheckToken(
643 user_id, base::Bind(&LoginDisplayHostImpl::OnTokenHandlerChecked,
644 pointer_factory_.GetWeakPtr()));
645 }
646 }
647 }
648
649 // We might be here after a reboot that was triggered after OOBE was complete, 633 // We might be here after a reboot that was triggered after OOBE was complete,
650 // so check for auto-enrollment again. This might catch a cached decision from 634 // so check for auto-enrollment again. This might catch a cached decision from
651 // a previous oobe flow, or might start a new check with the server. 635 // a previous oobe flow, or might start a new check with the server.
652 GetAutoEnrollmentController()->Start(); 636 GetAutoEnrollmentController()->Start();
653 637
654 // Initiate mobile config load. 638 // Initiate mobile config load.
655 MobileConfig::GetInstance(); 639 MobileConfig::GetInstance();
656 640
657 // Initiate device policy fetching. 641 // Initiate device policy fetching.
658 policy::BrowserPolicyConnectorChromeOS* connector = 642 policy::BrowserPolicyConnectorChromeOS* connector =
659 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 643 g_browser_process->platform_part()->browser_policy_connector_chromeos();
660 connector->ScheduleServiceInitialization( 644 connector->ScheduleServiceInitialization(
661 kPolicyServiceInitializationDelayMilliseconds); 645 kPolicyServiceInitializationDelayMilliseconds);
662 646
663 CHECK(webui_login_display_); 647 CHECK(webui_login_display_);
664 GetOobeUI()->ShowSigninScreen(context, 648 GetOobeUI()->ShowSigninScreen(context,
665 webui_login_display_, 649 webui_login_display_,
666 webui_login_display_); 650 webui_login_display_);
667 TRACE_EVENT_ASYNC_STEP_INTO0("ui", 651 TRACE_EVENT_ASYNC_STEP_INTO0("ui",
668 "ShowLoginWebUI", 652 "ShowLoginWebUI",
669 kShowLoginWebUIid, 653 kShowLoginWebUIid,
670 "WaitForScreenStateInitialize"); 654 "WaitForScreenStateInitialize");
671 BootTimesRecorder::Get()->RecordCurrentStats( 655 BootTimesRecorder::Get()->RecordCurrentStats(
672 "login-wait-for-signin-state-initialize"); 656 "login-wait-for-signin-state-initialize");
673 } 657 }
674 658
675 void LoginDisplayHostImpl::OnTokenHandlerChecked(
676 const user_manager::UserID& user_id,
677 TokenHandleUtil::TokenHandleStatus token_status) {
678 if (token_status == TokenHandleUtil::INVALID) {
679 user_manager::UserManager::Get()->SaveUserOAuthStatus(
680 user_id, user_manager::User::OAUTH2_TOKEN_STATUS_INVALID);
681 token_handle_util_->DeleteToken(user_id);
682 }
683 }
684
685 void LoginDisplayHostImpl::OnPreferencesChanged() { 659 void LoginDisplayHostImpl::OnPreferencesChanged() {
686 if (is_showing_login_) 660 if (is_showing_login_)
687 webui_login_display_->OnPreferencesChanged(); 661 webui_login_display_->OnPreferencesChanged();
688 } 662 }
689 663
690 void LoginDisplayHostImpl::PrewarmAuthentication() { 664 void LoginDisplayHostImpl::PrewarmAuthentication() {
691 auth_prewarmer_.reset(new AuthPrewarmer()); 665 auth_prewarmer_.reset(new AuthPrewarmer());
692 auth_prewarmer_->PrewarmAuthentication( 666 auth_prewarmer_->PrewarmAuthentication(
693 base::Bind(&LoginDisplayHostImpl::OnAuthPrewarmDone, 667 base::Bind(&LoginDisplayHostImpl::OnAuthPrewarmDone,
694 pointer_factory_.GetWeakPtr())); 668 pointer_factory_.GetWeakPtr()));
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 1280
1307 locale_util::SwitchLanguageCallback callback( 1281 locale_util::SwitchLanguageCallback callback(
1308 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); 1282 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())));
1309 1283
1310 // Load locale keyboards here. Hardware layout would be automatically enabled. 1284 // Load locale keyboards here. Hardware layout would be automatically enabled.
1311 locale_util::SwitchLanguage( 1285 locale_util::SwitchLanguage(
1312 locale, true, true /* login_layouts_only */, callback); 1286 locale, true, true /* login_layouts_only */, callback);
1313 } 1287 }
1314 1288
1315 } // namespace chromeos 1289 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698