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(¶ms); |
+ 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 */); |
} |