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

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

Issue 2315393002: [Signin Error Dialog] (2/3) Added handlers and UI constructors (Closed)
Patch Set: Rebase Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_handler.h ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7b407aa94aaa6f3ebf048bb6e2324b914083ee88 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,13 +64,15 @@ 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();
- LoginUIServiceFactory::GetForProfile(browser->profile())->
- SyncConfirmationUIClosed(LoginUIService::ABORT_SIGNIN);
- SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()))->SignOut(
- signin_metrics::ABORT_SIGNIN,
- signin_metrics::SignoutDelete::IGNORE_METRIC);
- browser->CloseModalSigninWindow();
+ Browser* browser = signin::GetDesktopBrowser(web_ui());
+ if (browser) {
+ LoginUIServiceFactory::GetForProfile(browser->profile())->
+ SyncConfirmationUIClosed(LoginUIService::ABORT_SIGNIN);
+ SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()))->SignOut(
+ signin_metrics::ABORT_SIGNIN,
+ signin_metrics::SignoutDelete::IGNORE_METRIC);
+ browser->CloseModalSigninWindow();
+ }
}
void SyncConfirmationHandler::SetUserImageURL(const std::string& picture_url) {
@@ -92,26 +94,22 @@ 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();
- LoginUIServiceFactory::GetForProfile(browser->profile())->
- SyncConfirmationUIClosed(result);
- browser->CloseModalSigninWindow();
+ Browser* browser = signin::GetDesktopBrowser(web_ui());
+ if (browser) {
+ LoginUIServiceFactory::GetForProfile(browser->profile())->
+ SyncConfirmationUIClosed(result);
+ browser->CloseModalSigninWindow();
+ }
}
void SyncConfirmationHandler::HandleInitializedWithSize(
const base::ListValue* args) {
- Browser* browser = GetDesktopBrowser();
+ Browser* browser = signin::GetDesktopBrowser(web_ui());
+ if (!browser)
+ return;
+
Profile* profile = browser->profile();
std::vector<AccountInfo> accounts =
AccountTrackerServiceFactory::GetForProfile(profile)->GetAccounts();
@@ -126,12 +124,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.
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_handler.h ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698