From 14f7ba7384a76499005bbf5aa3e6fcef88c03369 Mon Sep 17 00:00:00 2001 From: Dominique Fauteux-Chapleau Date: Thu, 21 Apr 2022 16:03:07 +0000 Subject: [PATCH] Fix colors in ContentAnalysisDialog This CL addresses the following 2 issues: - In crrev.com/c/3555730, the dialog's side icon logo's pending state color should have been kColorThrobber and not kColorThrobberPreconnect. The comments in that function have been updated so that "pending state" refers more clearly to the dialog and not the throbber. - In crrev.com/c/3573245, the removal of CircleBackground's constructor logic indirectly removed an important SetNativeControlColor call that gives the logo its correct background color (see crbug.com/1317630 for images of the broken colors). The code initializing this CircleBackground is updated so that call isn't missing. (cherry picked from commit a64eebe7ed935b996555eb6273098ffa584782f9) Bug: 1317630 Change-Id: I6a86bd9640bcfb5c09bd0cc0f98ca45ba4ebd131 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3594181 Auto-Submit: Dominique Fauteux-Chapleau Reviewed-by: Roger Tawa Commit-Queue: Roger Tawa Cr-Original-Commit-Position: refs/heads/main@{#993823} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3594819 Cr-Commit-Position: refs/branch-heads/5005@{#81} Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738} --- .../analysis/content_analysis_dialog.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.cc index 42121b0c0bb3d8..1b15188e23f89f 100644 --- a/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.cc +++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.cc @@ -158,8 +158,10 @@ class DeepScanningSideIconImageView : public DeepScanningBaseView, dialog()->GetSideImageLogoColor(), kSideImageSize)); if (dialog()->is_result()) { - SetBackground(std::make_unique( - dialog()->GetSideImageBackgroundColor())); + ui::ColorId color = dialog()->GetSideImageBackgroundColor(); + SetBackground(std::make_unique(color)); + GetBackground()->SetNativeControlColor( + GetColorProvider()->GetColor(color)); } } @@ -888,13 +890,15 @@ ui::ColorId ContentAnalysisDialog::GetSideImageLogoColor() const { switch (dialog_state_) { case State::PENDING: - // Match the spinner in the pending state. - return ui::kColorThrobberPreconnect; + // In the dialog's pending state, the side image is just an enterprise + // logo surrounded by a throbber, so we use the throbber color for it. + return ui::kColorThrobber; case State::SUCCESS: case State::FAILURE: case State::WARNING: - // In a result state the background will have the result's color, so the - // logo should have the same color as the background. + // In a result state, the side image is a circle colored with the result's + // color and an enterprise logo in front of it, so the logo should have + // the same color as the dialog's overall background. return ui::kColorDialogBackground; } }