Commit 3d89269b authored by Alex Ilin's avatar Alex Ilin Committed by Commit Bot

[signin] Force light mode for the reauth confirmation dialog

Gaia Reauth page doesn't support dark mode. The reauth confirmation
dialog is shown right before the Gaia Reauth. The transition between
the two dialogs looks weird if one of them is dark and another one is
light.

The reauth confirmation dialog should also be displayed in light mode
until Gaia Reauth supports dark mode.

Bug: 1115930
Change-Id: I535b62e6a8782406bb30ac7521060468f7e7afc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362928
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799113}
parent fccf10bf
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/common/web_preferences.h"
#include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/gaia_urls.h"
#include "third_party/blink/public/common/css/preferred_color_scheme.h"
namespace { namespace {
...@@ -309,8 +311,15 @@ void SigninReauthViewController::ShowReauthConfirmationDialog() { ...@@ -309,8 +311,15 @@ void SigninReauthViewController::ShowReauthConfirmationDialog() {
browser_, account_id_, access_point_); browser_, account_id_, access_point_);
dialog_delegate_observer_.Add(dialog_delegate_); dialog_delegate_observer_.Add(dialog_delegate_);
SigninReauthUI* web_dialog_ui = static_cast<SigninReauthUI*>( // Gaia Reauth page doesn't support dark mode. Force the confirmation dialog
dialog_delegate_->GetWebContents()->GetWebUI()->GetController()); // to use the light mode as well to match the style.
auto* web_contents = dialog_delegate_->GetWebContents();
auto prefs = web_contents->GetOrCreateWebPreferences();
prefs.preferred_color_scheme = blink::PreferredColorScheme::kLight;
web_contents->SetWebPreferences(prefs);
SigninReauthUI* web_dialog_ui =
web_contents->GetWebUI()->GetController()->GetAs<SigninReauthUI>();
web_dialog_ui->InitializeMessageHandlerWithReauthController(this); web_dialog_ui->InitializeMessageHandlerWithReauthController(this);
} }
......
...@@ -264,12 +264,9 @@ void SigninViewControllerDelegateViews::DisplayModal() { ...@@ -264,12 +264,9 @@ void SigninViewControllerDelegateViews::DisplayModal() {
NOTREACHED() << "Unsupported dialog modal type " << dialog_modal_type_; NOTREACHED() << "Unsupported dialog modal type " << dialog_modal_type_;
} }
if (should_show_close_button_) { if (should_show_close_button_) {
SkColor border_color = GetNativeTheme()->ShouldUseDarkColors()
? gfx::kGoogleGrey900
: SK_ColorWHITE;
GetBubbleFrameView()->SetBubbleBorder(std::make_unique<views::BubbleBorder>( GetBubbleFrameView()->SetBubbleBorder(std::make_unique<views::BubbleBorder>(
views::BubbleBorder::NONE, views::BubbleBorder::BIG_SHADOW, views::BubbleBorder::NONE, views::BubbleBorder::BIG_SHADOW,
border_color)); SK_ColorWHITE));
} }
content_view_->RequestFocus(); content_view_->RequestFocus();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "components/signin/public/identity_manager/account_info.h" #include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/consent_level.h" #include "components/signin/public/identity_manager/consent_level.h"
#include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_manager.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
#include "google_apis/gaia/core_account_id.h" #include "google_apis/gaia/core_account_id.h"
#include "services/network/public/mojom/content_security_policy.mojom.h" #include "services/network/public/mojom/content_security_policy.mojom.h"
...@@ -159,3 +160,5 @@ void SigninReauthUI::AddStringResource(content::WebUIDataSource* source, ...@@ -159,3 +160,5 @@ void SigninReauthUI::AddStringResource(content::WebUIDataSource* source,
js_localized_string_to_ids_.emplace_back(sanitized_string, ids); js_localized_string_to_ids_.emplace_back(sanitized_string, ids);
} }
WEB_UI_CONTROLLER_TYPE_IMPL(SigninReauthUI)
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <vector> #include <vector>
#include "chrome/browser/ui/webui/signin/signin_web_dialog_ui.h" #include "chrome/browser/ui/webui/signin/signin_web_dialog_ui.h"
#include "content/public/browser/web_ui_controller.h"
class Browser; class Browser;
class SigninReauthViewController; class SigninReauthViewController;
...@@ -16,7 +17,7 @@ class SigninReauthViewController; ...@@ -16,7 +17,7 @@ class SigninReauthViewController;
namespace content { namespace content {
class WebUI; class WebUI;
class WebUIDataSource; class WebUIDataSource;
} } // namespace content
// WebUI controller for the signin reauth dialog. // WebUI controller for the signin reauth dialog.
// //
...@@ -60,6 +61,8 @@ class SigninReauthUI : public SigninWebDialogUI { ...@@ -60,6 +61,8 @@ class SigninReauthUI : public SigninWebDialogUI {
// For consent auditing. // For consent auditing.
std::vector<std::pair<std::string, int>> js_localized_string_to_ids_; std::vector<std::pair<std::string, int>> js_localized_string_to_ids_;
WEB_UI_CONTROLLER_TYPE_DECL();
}; };
#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_REAUTH_UI_H_ #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_REAUTH_UI_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment