Chromium Code Reviews| Index: chrome/browser/ui/webui/signin/sync_confirmation_handler.cc |
| diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc |
| index b538951d47f26e5dc6aeec41d7fdde8ebaf10077..4372811d930ef8894ad2eb868603d890fd59a4cb 100644 |
| --- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc |
| +++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc |
| @@ -10,10 +10,10 @@ |
| #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| #include "chrome/browser/signin/account_tracker_service_factory.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| -#include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/signin_view_controller_delegate.h" |
| #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| +#include "chrome/browser/ui/webui/signin/signin_utils.h" |
| #include "components/signin/core/browser/account_tracker_service.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -64,7 +64,8 @@ void SyncConfirmationHandler::HandleGoToSettings(const base::ListValue* args) { |
| void SyncConfirmationHandler::HandleUndo(const base::ListValue* args) { |
| did_user_explicitly_interact = true; |
| content::RecordAction(base::UserMetricsAction("Signin_Undo_Signin")); |
| - Browser* browser = GetDesktopBrowser(); |
| + Browser* browser = signin::GetDesktopBrowser(web_ui()); |
| + DCHECK(browser); |
|
achuithb
2016/09/12 19:19:26
Doesn't this crash on the next line if browser is
anthonyvd
2016/09/13 14:25:58
Good point. Since there's really nothing to do in
|
| LoginUIServiceFactory::GetForProfile(browser->profile())-> |
| SyncConfirmationUIClosed(LoginUIService::ABORT_SIGNIN); |
| SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()))->SignOut( |
| @@ -92,18 +93,10 @@ void SyncConfirmationHandler::OnAccountUpdated(const AccountInfo& info) { |
| SetUserImageURL(info.picture_url); |
| } |
| -Browser* SyncConfirmationHandler::GetDesktopBrowser() { |
| - Browser* browser = chrome::FindBrowserWithWebContents( |
| - web_ui()->GetWebContents()); |
| - if (!browser) |
| - browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui())); |
| - DCHECK(browser); |
| - return browser; |
| -} |
| - |
| void SyncConfirmationHandler::CloseModalSigninWindow( |
| LoginUIService::SyncConfirmationUIClosedResult result) { |
| - Browser* browser = GetDesktopBrowser(); |
| + Browser* browser = signin::GetDesktopBrowser(web_ui()); |
| + DCHECK(browser); |
| LoginUIServiceFactory::GetForProfile(browser->profile())-> |
| SyncConfirmationUIClosed(result); |
| browser->CloseModalSigninWindow(); |
| @@ -111,7 +104,8 @@ void SyncConfirmationHandler::CloseModalSigninWindow( |
| void SyncConfirmationHandler::HandleInitializedWithSize( |
| const base::ListValue* args) { |
| - Browser* browser = GetDesktopBrowser(); |
| + Browser* browser = signin::GetDesktopBrowser(web_ui()); |
| + DCHECK(browser); |
| Profile* profile = browser->profile(); |
| std::vector<AccountInfo> accounts = |
| AccountTrackerServiceFactory::GetForProfile(profile)->GetAccounts(); |
| @@ -126,12 +120,7 @@ void SyncConfirmationHandler::HandleInitializedWithSize( |
| else |
| SetUserImageURL(primary_account_info.picture_url); |
| - double height; |
| - bool success = args->GetDouble(0, &height); |
| - DCHECK(success); |
| - |
| - browser->signin_view_controller()->SetModalSigninHeight( |
| - static_cast<int>(height)); |
| + signin::SetInitializedModalHeight(web_ui(), args); |
| // After the dialog is shown, some platforms might have an element focused. |
| // To be consistent, clear the focused element on all platforms. |