Skip to content

Commit

Permalink
Fix colors in ContentAnalysisDialog
Browse files Browse the repository at this point in the history
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 a64eebe)

Bug: 1317630
Change-Id: I6a86bd9640bcfb5c09bd0cc0f98ca45ba4ebd131
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3594181
Auto-Submit: Dominique Fauteux-Chapleau <domfc@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Commit-Queue: Roger Tawa <rogerta@chromium.org>
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: 5b4d945-refs/heads/main@{#992738}
  • Loading branch information
dominiquefc authored and Chromium LUCI CQ committed Apr 21, 2022
1 parent 8baa2c4 commit 14f7ba7
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -158,8 +158,10 @@ class DeepScanningSideIconImageView : public DeepScanningBaseView,
dialog()->GetSideImageLogoColor(),
kSideImageSize));
if (dialog()->is_result()) {
SetBackground(std::make_unique<CircleBackground>(
dialog()->GetSideImageBackgroundColor()));
ui::ColorId color = dialog()->GetSideImageBackgroundColor();
SetBackground(std::make_unique<CircleBackground>(color));
GetBackground()->SetNativeControlColor(
GetColorProvider()->GetColor(color));
}
}

Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 14f7ba7

Please sign in to comment.