| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 9 #include "chrome/browser/signin/account_tracker_service_factory.h" | 9 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 DCHECK(info.IsValid()); | 89 DCHECK(info.IsValid()); |
| 90 Profile* profile = Profile::FromWebUI(web_ui()); | 90 Profile* profile = Profile::FromWebUI(web_ui()); |
| 91 AccountTrackerServiceFactory::GetForProfile(profile)->RemoveObserver(this); | 91 AccountTrackerServiceFactory::GetForProfile(profile)->RemoveObserver(this); |
| 92 | 92 |
| 93 SetUserImageURL(info.picture_url); | 93 SetUserImageURL(info.picture_url); |
| 94 } | 94 } |
| 95 | 95 |
| 96 Browser* SyncConfirmationHandler::GetDesktopBrowser() { | 96 Browser* SyncConfirmationHandler::GetDesktopBrowser() { |
| 97 Browser* browser = chrome::FindBrowserWithWebContents( | 97 Browser* browser = chrome::FindBrowserWithWebContents( |
| 98 web_ui()->GetWebContents()); | 98 web_ui()->GetWebContents()); |
| 99 if (!browser) { | 99 if (!browser) |
| 100 browser = chrome::FindLastActiveWithProfile( | 100 browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui())); |
| 101 Profile::FromWebUI(web_ui()), chrome::GetActiveDesktop()); | |
| 102 } | |
| 103 DCHECK(browser); | 101 DCHECK(browser); |
| 104 return browser; | 102 return browser; |
| 105 } | 103 } |
| 106 | 104 |
| 107 void SyncConfirmationHandler::CloseModalSigninWindow( | 105 void SyncConfirmationHandler::CloseModalSigninWindow( |
| 108 LoginUIService::SyncConfirmationUIClosedResults results) { | 106 LoginUIService::SyncConfirmationUIClosedResults results) { |
| 109 Browser* browser = GetDesktopBrowser(); | 107 Browser* browser = GetDesktopBrowser(); |
| 110 LoginUIServiceFactory::GetForProfile(browser->profile())-> | 108 LoginUIServiceFactory::GetForProfile(browser->profile())-> |
| 111 SyncConfirmationUIClosed(results); | 109 SyncConfirmationUIClosed(results); |
| 112 browser->window()->CloseModalSigninWindow(); | 110 browser->window()->CloseModalSigninWindow(); |
| 113 } | 111 } |
| OLD | NEW |