| 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 afcddd84675ca5d1be828162b590fca29d63e105..2353921c46179af2c444a2504b985c48074954e4 100644
|
| --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
|
| +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
|
| @@ -31,6 +31,7 @@
|
| #include "chrome/browser/ui/browser_tabstrip.h"
|
| #include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/chrome_pages.h"
|
| +#include "chrome/browser/ui/sync/one_click_signin_sync_observer.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| #include "chrome/browser/ui/webui/signin/login_ui_service.h"
|
| #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
|
| @@ -53,14 +54,17 @@ OneClickSigninSyncStarter::OneClickSigninSyncStarter(
|
| StartSyncMode start_mode,
|
| content::WebContents* web_contents,
|
| ConfirmationRequired confirmation_required,
|
| + const GURL& continue_url,
|
| Callback sync_setup_completed_callback)
|
| : content::WebContentsObserver(web_contents),
|
| start_mode_(start_mode),
|
| desktop_type_(chrome::HOST_DESKTOP_TYPE_NATIVE),
|
| confirmation_required_(confirmation_required),
|
| + continue_url_(continue_url),
|
| sync_setup_completed_callback_(sync_setup_completed_callback),
|
| weak_pointer_factory_(this) {
|
| DCHECK(profile);
|
| + DCHECK(web_contents || continue_url.is_empty());
|
| BrowserList::AddObserver(this);
|
|
|
| Initialize(profile, browser);
|
| @@ -400,9 +404,17 @@ void OneClickSigninSyncStarter::MergeSessionComplete(
|
| case SHOW_SETTINGS_WITHOUT_CONFIGURE:
|
| ShowSettingsPage(false); // Don't show sync config UI.
|
| break;
|
| - default:
|
| + case UNDO_SYNC:
|
| NOTREACHED();
|
| }
|
| +
|
| + // Navigate to the |continue_url_| if one is set, unless the user first needs
|
| + // to configure Sync.
|
| + if (web_contents() && !continue_url_.is_empty() &&
|
| + start_mode_ != CONFIGURE_SYNC_FIRST) {
|
| + LoadContinueUrl();
|
| + }
|
| +
|
| delete this;
|
| }
|
|
|
| @@ -483,12 +495,15 @@ void OneClickSigninSyncStarter::ShowSettingsPage(bool configure_sync) {
|
| }
|
| }
|
| } else {
|
| - // Sync is disabled - just display the settings page.
|
| + // Sync is disabled - just display the settings page or redirect to the
|
| + // |continue_url_|.
|
| FinishProfileSyncServiceSetup();
|
| - if (use_same_tab)
|
| - ShowSettingsPageInWebContents(web_contents(), std::string());
|
| - else
|
| + if (!use_same_tab)
|
| chrome::ShowSettings(browser_);
|
| + else if (!continue_url_.is_empty())
|
| + LoadContinueUrl();
|
| + else
|
| + ShowSettingsPageInWebContents(web_contents(), std::string());
|
| }
|
| }
|
| }
|
| @@ -510,6 +525,12 @@ void OneClickSigninSyncStarter::FinishProfileSyncServiceSetup() {
|
| void OneClickSigninSyncStarter::ShowSettingsPageInWebContents(
|
| content::WebContents* contents,
|
| const std::string& sub_page) {
|
| + if (!continue_url_.is_empty()) {
|
| + // The observer deletes itself once it's done.
|
| + DCHECK(!sub_page.empty());
|
| + new OneClickSigninSyncObserver(contents, continue_url_);
|
| + }
|
| +
|
| GURL url = chrome::GetSettingsUrl(sub_page);
|
| content::OpenURLParams params(url,
|
| content::Referrer(),
|
| @@ -525,3 +546,11 @@ void OneClickSigninSyncStarter::ShowSettingsPageInWebContents(
|
| browser->tab_strip_model()->ActivateTabAt(content_index,
|
| false /* user_gesture */);
|
| }
|
| +
|
| +void OneClickSigninSyncStarter::LoadContinueUrl() {
|
| + web_contents()->GetController().LoadURL(
|
| + continue_url_,
|
| + content::Referrer(),
|
| + content::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
| + std::string());
|
| +}
|
|
|