Index: chrome/browser/ui/sync/one_click_signin_helper.cc |
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc |
index fe024634f7698f3bb93eec96341912e62b18f263..b388be38b64b46d204e9f83e9bd0a69013b384df 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
@@ -18,6 +18,7 @@ |
#include "chrome/browser/signin/signin_manager.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
+#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
#include "chrome/browser/tab_contents/tab_util.h" |
#include "chrome/browser/ui/browser_finder.h" |
@@ -225,6 +226,21 @@ bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents, |
if (!manager->GetAuthenticatedUsername().empty()) |
return false; |
+ |
+ // If we're about to show a one-click infobar but the user has started |
+ // a concurrent signin flow (perhaps via the promo), we may not have yet |
+ // established an authenticated username but we still shouldn't move |
+ // forward with two simultaneous signin processes. This is a bit |
+ // contentious as the one-click flow is a much smoother flow from the user |
+ // perspective, but it's much more difficult to hijack the other flow from |
+ // here as it is to bail. |
+ ProfileSyncService* service = |
+ ProfileSyncServiceFactory::GetForProfile(profile); |
+ if (!service) |
+ return false; |
+ |
+ if (service->FirstSetupInProgress()) |
+ return false; |
} |
return true; |