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

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

Issue 22510004: Show sync setup in same tab as sign in instead of active tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style Created 7 years, 4 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 d037dabbf65c76610a2f32540f3db8f5be98db44..a2841eb500e51d0f54fd5e47fbe353bf290fa167 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -48,12 +48,12 @@ OneClickSigninSyncStarter::OneClickSigninSyncStarter(
const std::string& email,
const std::string& password,
StartSyncMode start_mode,
- bool force_same_tab_navigation,
+ content::WebContents* web_contents,
ConfirmationRequired confirmation_required,
signin::Source source,
Callback sync_setup_completed_callback)
- : start_mode_(start_mode),
- force_same_tab_navigation_(force_same_tab_navigation),
+ : content::WebContentsObserver(web_contents),
+ start_mode_(start_mode),
confirmation_required_(confirmation_required),
source_(source),
sync_setup_completed_callback_(sync_setup_completed_callback),
@@ -424,7 +424,7 @@ void OneClickSigninSyncStarter::ShowSettingsPageInNewTab(bool configure_sync) {
EnsureBrowser();
if (profile_sync_service) {
// Need to navigate to the settings page and display the sync UI.
- if (force_same_tab_navigation_) {
+ if (web_contents()) {
ShowSyncSettingsPageOnSameTab();
} else {
// If the user is setting up sync for the first time, let them configure
@@ -460,11 +460,22 @@ void OneClickSigninSyncStarter::FinishProfileSyncServiceSetup() {
}
void OneClickSigninSyncStarter::ShowSyncSettingsPageOnSameTab() {
noms 2013/08/08 20:19:24 Can you maybe pass the web_contents here as a para
fdoray 2013/08/09 15:31:13 Done.
+ content::WebContents* contents = web_contents();
+ DCHECK(contents);
+
std::string url = std::string(chrome::kChromeUISettingsURL) +
chrome::kSyncSetupSubPage;
- chrome::NavigateParams params(
- browser_, GURL(url), content::PAGE_TRANSITION_AUTO_TOPLEVEL);
- params.disposition = CURRENT_TAB;
- params.window_action = chrome::NavigateParams::SHOW_WINDOW;
- chrome::Navigate(&params);
+ content::OpenURLParams params(GURL(url),
+ content::Referrer(),
+ CURRENT_TAB,
+ content::PAGE_TRANSITION_AUTO_TOPLEVEL,
+ false);
+ contents->OpenURL(params);
+
+ // Activate the tab.
+ Browser* browser = chrome::FindBrowserWithWebContents(contents);
+ int content_index =
+ browser->tab_strip_model()->GetIndexOfWebContents(contents);
+ browser->tab_strip_model()->ActivateTabAt(content_index,
+ false /* user_gesture */);
}

Powered by Google App Engine
This is Rietveld 408576698