Chromium Code Reviews| Index: chrome/browser/ui/sync/one_click_signin_sync_observer.cc |
| diff --git a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc |
| index 38ed198dbfcdb021ddf9327ea175dcc6c46c4081..2d1079a1e92abd6a275aee796d3f9669c277dcff 100644 |
| --- a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc |
| +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc |
| @@ -28,11 +28,17 @@ void CloseTab(content::WebContents* tab) { |
| OneClickSigninSyncObserver::OneClickSigninSyncObserver( |
| content::WebContents* web_contents, |
| + Profile* profile, |
| + Browser* browser, |
| + const GURL& activity_controls_url, |
| const GURL& continue_url) |
| : content::WebContentsObserver(web_contents), |
| + profile_(profile), |
| + browser_(browser), |
| + activity_controls_url_(activity_controls_url), |
| continue_url_(continue_url), |
| weak_ptr_factory_(this) { |
| - DCHECK(!continue_url_.is_empty()); |
| + DCHECK(!continue_url_.is_empty() || !activity_controls_url.is_empty()); |
|
Roger Tawa OOO till Jul 10th
2016/03/23 01:14:15
This DCHECK verifies that both URLs are not empty,
Moe
2016/03/24 00:02:40
Right now, OneClickSigninSyncObserver is used for
|
| ProfileSyncService* sync_service = GetSyncService(web_contents); |
| if (sync_service) { |
| @@ -78,6 +84,16 @@ void OneClickSigninSyncObserver::OnStateChanged() { |
| return; |
| } |
| + if (!activity_controls_url_.is_empty()) { |
| + // Open the 'Activity controls' section of the privacy settings. |
| + content::OpenURLParams params(activity_controls_url_, |
| + content::Referrer(), |
| + NEW_FOREGROUND_TAB, |
| + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| + false); |
| + browser_->OpenURL(params); |
| + } |
| + |
| if (sync_service->IsSyncActive() && |
| signin::GetAccessPointForPromoURL(continue_url_) != |
| signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS) { |
| @@ -101,9 +117,7 @@ void OneClickSigninSyncObserver::LoadContinueUrl() { |
| ProfileSyncService* OneClickSigninSyncObserver::GetSyncService( |
| content::WebContents* web_contents) { |
| - Profile* profile = |
| - Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| - return ProfileSyncServiceFactory::GetForProfile(profile); |
| + return ProfileSyncServiceFactory::GetForProfile(profile_); |
| } |
| // static |