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

Unified Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 2442843002: Override SigninManager::SignOut if force-signin is enabled. (Closed)
Patch Set: tommycli's comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/sync/one_click_signin_sync_starter.cc
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
index cc30fc02e518df618103910c478ea5065ba1c89a..84cc5dad166ac991eb6fa467e39c6e349c54702a 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -12,11 +12,13 @@
#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_window.h"
+#include "chrome/browser/signin/force_signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/signin_tracker_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
@@ -141,6 +143,7 @@ void OneClickSigninSyncStarter::Initialize(Profile* profile, Browser* browser) {
// will not be able to complete successfully.
syncer::SyncPrefs sync_prefs(profile_->GetPrefs());
sync_prefs.SetSyncRequested(true);
+ skip_sync_confirm_ = false;
}
void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) {
@@ -310,7 +313,14 @@ void OneClickSigninSyncStarter::CompleteInitForNewProfile(
FinishProfileSyncServiceSetup();
Initialize(new_profile, nullptr);
DCHECK_EQ(profile_, new_profile);
-
+ skip_sync_confirm_ = true;
+
+ // When force signin enabled, all browser window will be closed and
+ // UserManager will be shown during signout. However, the UserManager
+ // doesn't need to be shown here because we will create a new window for
+ // the new profile soon.
+ ForceSigninManager::DisableUserManagerDisplayForNextSignOut(
+ old_signin_manager);
Roger Tawa OOO till Jul 10th 2016/10/26 18:25:32 Instead of calling this here, seems like it would
// We've transferred our credentials to the new profile - notify that
// the signin for the original profile was cancelled (must do this after
// we have called Initialize() with the new profile, as otherwise this
@@ -322,6 +332,15 @@ void OneClickSigninSyncStarter::CompleteInitForNewProfile(
// loading the signin process will complete.
LoadPolicyWithCachedCredentials();
+ // Unlock the new profile.
+ ProfileAttributesEntry* entry;
+ bool has_entry =
+ g_browser_process->profile_manager()
+ ->GetProfileAttributesStorage()
+ .GetProfileAttributesWithPath(new_profile->GetPath(), &entry);
+ DCHECK(has_entry);
+ entry->SetIsSigninRequired(false);
+
// Open the profile's first window, after all initialization.
profiles::FindOrCreateNewWindowForProfile(
new_profile,
@@ -466,6 +485,15 @@ void OneClickSigninSyncStarter::AccountAddedToCookie(
// Regardless of whether the account was successfully added or not,
// continue with sync starting.
+ // TODO(zmin): Remove this hack once the https://crbug.com/657924 fixed.
+ // Skip the Sync confirmation dialog if user choose to create a new profile
+ // for the corp signin. This is because the dialog doesn't work properly
+ // after the corp signin.
+ if (skip_sync_confirm_) {
+ OnSyncConfirmationUIClosed(LoginUIService::ABORT_SIGNIN);
+ return;
+ }
+
if (switches::UsePasswordSeparatedSigninFlow()) {
// Under the new signin flow, the sync confirmation dialog should always be
// shown regardless of |start_mode_|. |sync_setup_completed_callback_| will

Powered by Google App Engine
This is Rietveld 408576698