| 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..648f9eaedd15f19cbaa6ff26fbfa8ef63d228841 100644
|
| --- a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc
|
| +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h"
|
|
|
| +#include <string>
|
| +
|
| #include "base/bind.h"
|
| #include "base/location.h"
|
| #include "base/single_thread_task_runner.h"
|
| @@ -28,13 +30,19 @@ 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());
|
|
|
| - ProfileSyncService* sync_service = GetSyncService(web_contents);
|
| + ProfileSyncService* sync_service = GetSyncService();
|
| if (sync_service) {
|
| sync_service->AddObserver(this);
|
| } else {
|
| @@ -53,7 +61,7 @@ OneClickSigninSyncObserver::OneClickSigninSyncObserver(
|
| OneClickSigninSyncObserver::~OneClickSigninSyncObserver() {}
|
|
|
| void OneClickSigninSyncObserver::WebContentsDestroyed() {
|
| - ProfileSyncService* sync_service = GetSyncService(web_contents());
|
| + ProfileSyncService* sync_service = GetSyncService();
|
| if (sync_service)
|
| sync_service->RemoveObserver(this);
|
|
|
| @@ -61,7 +69,7 @@ void OneClickSigninSyncObserver::WebContentsDestroyed() {
|
| }
|
|
|
| void OneClickSigninSyncObserver::OnStateChanged() {
|
| - ProfileSyncService* sync_service = GetSyncService(web_contents());
|
| + ProfileSyncService* sync_service = GetSyncService();
|
|
|
| // At this point, the sign-in process is complete, and control has been handed
|
| // back to the sync engine. Close the gaia sign in tab if the |continue_url_|
|
| @@ -78,7 +86,17 @@ void OneClickSigninSyncObserver::OnStateChanged() {
|
| return;
|
| }
|
|
|
| - if (sync_service->IsSyncActive() &&
|
| + 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() && !continue_url_.is_empty() &&
|
| signin::GetAccessPointForPromoURL(continue_url_) !=
|
| signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS) {
|
| // TODO(isherman): Having multiple settings pages open can cause issues
|
| @@ -99,11 +117,8 @@ void OneClickSigninSyncObserver::LoadContinueUrl() {
|
| std::string());
|
| }
|
|
|
| -ProfileSyncService* OneClickSigninSyncObserver::GetSyncService(
|
| - content::WebContents* web_contents) {
|
| - Profile* profile =
|
| - Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
| - return ProfileSyncServiceFactory::GetForProfile(profile);
|
| +ProfileSyncService* OneClickSigninSyncObserver::GetSyncService() {
|
| + return ProfileSyncServiceFactory::GetForProfile(profile_);
|
| }
|
|
|
| // static
|
|
|