#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
+#include "chrome/browser/signin/profile_oauth2_token_service.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_global_error.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/signin_promo.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
+#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/sync/signin_histogram.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
"tabs"
};
-COMPILE_ASSERT(31 == syncer::MODEL_TYPE_COUNT,
+COMPILE_ASSERT(32 == syncer::MODEL_TYPE_COUNT,
update_kDataTypeNames_to_match_UserSelectableTypes);
typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap;
}
void SyncSetupHandler::DisplayGaiaLoginInNewTabOrWindow() {
- GURL url(signin::GetPromoURL(signin::SOURCE_SETTINGS,
- true)); // auto close after success.
Browser* browser = chrome::FindBrowserWithWebContents(
web_ui()->GetWebContents());
if (!browser) {
// If the signin manager already has an authenticated username, this is a
// re-auth scenario, and we need to ensure that the user signs in with the
// same email address.
+ GURL url;
std::string email = SigninManagerFactory::GetForProfile(
browser->profile())->GetAuthenticatedUsername();
if (!email.empty()) {
UMA_HISTOGRAM_ENUMERATION("Signin.Reauth",
signin::HISTOGRAM_SHOWN,
signin::HISTOGRAM_MAX);
- url = net::AppendQueryParameter(url, "Email", email);
+
+ SigninGlobalError* signin_error =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(browser->profile())->
+ signin_global_error();
+ DCHECK(signin_error->HasMenuItem());
+ url = signin::GetReauthURL(browser->profile(),
+ signin_error->GetAccountIdOfLastAuthError());
+ } else {
+ url = signin::GetPromoURL(signin::SOURCE_SETTINGS, true);
}
- browser->OpenURL(
- content::OpenURLParams(url, content::Referrer(), SINGLETON_TAB,
- content::PAGE_TRANSITION_AUTO_BOOKMARK, false));
+ chrome::ShowSingletonTab(browser, url);
}
#endif
// Disable sync, but remain signed in if the user selected "Sync nothing" in
// the advanced settings dialog. Note: In order to disable sync across
- // restarts on Chrome OS, we must call OnStopSyncingPermanently(), which
+ // restarts on Chrome OS, we must call StopSyncingPermanently(), which
// suppresses sync startup in addition to disabling it.
if (configuration.sync_nothing) {
ProfileSyncService::SyncEvent(
ProfileSyncService::STOP_FROM_ADVANCED_DIALOG);
CloseUI();
- service->OnStopSyncingPermanently();
+ service->StopSyncingPermanently();
service->SetSetupInProgress(false);
return;
}
// If the user clicked "Cancel" while setting up sync, disable sync
// because we don't want the sync backend to remain in the initialized
// state. Note: In order to disable sync across restarts on Chrome OS, we
- // must call OnStopSyncingPermanently(), which suppresses sync startup in
+ // must call StopSyncingPermanently(), which suppresses sync startup in
// addition to disabling it.
if (sync_service) {
DVLOG(1) << "Sync setup aborted by user action";
- sync_service->OnStopSyncingPermanently();
+ sync_service->StopSyncingPermanently();
#if !defined(OS_CHROMEOS)
// Sign out the user on desktop Chrome if they click cancel during
// initial setup.