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 23ef9f2093702b21f3fb4310554019e625f9adad..2ae65d9e5903d2a311755eb977c7d13c2a2a1259 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" |
@@ -51,14 +52,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); |
@@ -398,9 +402,21 @@ 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) { |
+ web_contents()->GetController().LoadURL( |
+ continue_url_, |
+ content::Referrer(), |
+ content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
+ std::string()); |
+ } |
+ |
delete this; |
} |
@@ -508,6 +524,13 @@ 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. |
+ // TODO(isherman): Perhaps only do this when the |sub_page| is the |
+ // configuration page? |
Ilya Sherman
2014/03/20 08:41:45
^^^
guohui
2014/03/21 19:04:15
|sub_page| is not configuration page only if sync
Ilya Sherman
2014/03/22 00:06:28
Done.
|
+ new OneClickSigninSyncObserver(contents, continue_url_); |
+ } |
+ |
std::string url = std::string(chrome::kChromeUISettingsURL) + sub_page; |
content::OpenURLParams params(GURL(url), |
content::Referrer(), |