Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2947)

Unified Diff: chrome/browser/ui/webui/signin/sync_confirmation_handler.cc

Issue 2275883003: [Signin Error Dialog] (2/3) Added handlers and UI constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@error-modal-web
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8d348e076e67e1f16da97a4b019bf305336bcc02 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -10,9 +10,9 @@
#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/get_desktop_browser.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "content/public/browser/user_metrics.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);
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();

Powered by Google App Engine
This is Rietveld 408576698