| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" | 5 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" |
| 6 | 6 |
| 7 #include <vector> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 9 #include "chrome/browser/signin/account_tracker_service_factory.h" | 11 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 15 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 14 #include "components/signin/core/browser/account_tracker_service.h" | 16 #include "components/signin/core/browser/account_tracker_service.h" |
| 15 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 16 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 base::Bind(&SyncConfirmationHandler::HandleUndo, base::Unretained(this))); | 36 base::Bind(&SyncConfirmationHandler::HandleUndo, base::Unretained(this))); |
| 35 web_ui()->RegisterMessageCallback("initialized", | 37 web_ui()->RegisterMessageCallback("initialized", |
| 36 base::Bind(&SyncConfirmationHandler::HandleInitialized, | 38 base::Bind(&SyncConfirmationHandler::HandleInitialized, |
| 37 base::Unretained(this))); | 39 base::Unretained(this))); |
| 38 web_ui()->RegisterMessageCallback("goToSettings", | 40 web_ui()->RegisterMessageCallback("goToSettings", |
| 39 base::Bind(&SyncConfirmationHandler::HandleGoToSettings, | 41 base::Bind(&SyncConfirmationHandler::HandleGoToSettings, |
| 40 base::Unretained(this))); | 42 base::Unretained(this))); |
| 41 } | 43 } |
| 42 | 44 |
| 43 void SyncConfirmationHandler::HandleConfirm(const base::ListValue* args) { | 45 void SyncConfirmationHandler::HandleConfirm(const base::ListValue* args) { |
| 44 CloseModalSigninWindow(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); | 46 bool open_activity_controls = false; |
| 47 bool success = args->GetBoolean(0, &open_activity_controls); |
| 48 DCHECK(success); |
| 49 LoginUIService::SyncConfirmationUIClosedResults results = |
| 50 open_activity_controls ? LoginUIService::SYNC_WITH_ACTIVITY_CONTROLS: |
| 51 LoginUIService::SYNC_WITH_DEFAULT_SETTINGS; |
| 52 CloseModalSigninWindow(results); |
| 45 } | 53 } |
| 46 | 54 |
| 47 void SyncConfirmationHandler::HandleGoToSettings(const base::ListValue* args) { | 55 void SyncConfirmationHandler::HandleGoToSettings(const base::ListValue* args) { |
| 48 CloseModalSigninWindow(LoginUIService::CONFIGURE_SYNC_FIRST); | 56 CloseModalSigninWindow(LoginUIService::CONFIGURE_SYNC_FIRST); |
| 49 } | 57 } |
| 50 | 58 |
| 51 void SyncConfirmationHandler::HandleUndo(const base::ListValue* args) { | 59 void SyncConfirmationHandler::HandleUndo(const base::ListValue* args) { |
| 52 content::RecordAction(base::UserMetricsAction("Signin_Undo_Signin")); | 60 content::RecordAction(base::UserMetricsAction("Signin_Undo_Signin")); |
| 53 Browser* browser = GetDesktopBrowser(); | 61 Browser* browser = GetDesktopBrowser(); |
| 54 LoginUIServiceFactory::GetForProfile(browser->profile())-> | 62 LoginUIServiceFactory::GetForProfile(browser->profile())-> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return browser; | 112 return browser; |
| 105 } | 113 } |
| 106 | 114 |
| 107 void SyncConfirmationHandler::CloseModalSigninWindow( | 115 void SyncConfirmationHandler::CloseModalSigninWindow( |
| 108 LoginUIService::SyncConfirmationUIClosedResults results) { | 116 LoginUIService::SyncConfirmationUIClosedResults results) { |
| 109 Browser* browser = GetDesktopBrowser(); | 117 Browser* browser = GetDesktopBrowser(); |
| 110 LoginUIServiceFactory::GetForProfile(browser->profile())-> | 118 LoginUIServiceFactory::GetForProfile(browser->profile())-> |
| 111 SyncConfirmationUIClosed(results); | 119 SyncConfirmationUIClosed(results); |
| 112 browser->CloseModalSigninWindow(); | 120 browser->CloseModalSigninWindow(); |
| 113 } | 121 } |
| OLD | NEW |