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

Unified Diff: ui/views/controls/focusable_border.cc

Issue 2406363003: Update appearance of invalid textfields in Harmony. (Closed)
Patch Set: combine install with setcolorid Created 4 years, 2 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 | « ui/views/controls/focusable_border.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/focusable_border.cc
diff --git a/ui/views/controls/focusable_border.cc b/ui/views/controls/focusable_border.cc
index fbe8cb2a4e479d4a4868405733f7b1c1929d1bb6..225dfb9d2f649b39b5c0f034507de1c3bf59f628 100644
--- a/ui/views/controls/focusable_border.cc
+++ b/ui/views/controls/focusable_border.cc
@@ -24,22 +24,14 @@ const int kInsetSize = 1;
namespace views {
-FocusableBorder::FocusableBorder()
- : insets_(kInsetSize, kInsetSize, kInsetSize, kInsetSize),
- override_color_(gfx::kPlaceholderColor),
- use_default_color_(true) {
-}
+FocusableBorder::FocusableBorder() : insets_(kInsetSize) {}
FocusableBorder::~FocusableBorder() {
}
-void FocusableBorder::SetColor(SkColor color) {
- override_color_ = color;
- use_default_color_ = false;
-}
-
-void FocusableBorder::UseDefaultColor() {
- use_default_color_ = true;
+void FocusableBorder::SetColorId(
+ const base::Optional<ui::NativeTheme::ColorId>& color_id) {
+ override_color_id_ = color_id;
}
void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) {
@@ -87,18 +79,19 @@ void FocusableBorder::SetInsets(int top, int left, int bottom, int right) {
}
SkColor FocusableBorder::GetCurrentColor(const View& view) const {
- if (!use_default_color_)
- return override_color_;
-
- SkColor color = view.GetNativeTheme()->GetSystemColor(
- view.HasFocus() ? ui::NativeTheme::kColorId_FocusedBorderColor :
- ui::NativeTheme::kColorId_UnfocusedBorderColor);
+ ui::NativeTheme::ColorId color_id =
+ ui::NativeTheme::kColorId_UnfocusedBorderColor;
+ if (override_color_id_)
+ color_id = *override_color_id_;
+ else if (view.HasFocus())
+ color_id = ui::NativeTheme::kColorId_FocusedBorderColor;
+
+ SkColor color = view.GetNativeTheme()->GetSystemColor(color_id);
if (ui::MaterialDesignController::IsSecondaryUiMaterial() &&
!view.enabled()) {
return color_utils::BlendTowardOppositeLuma(color,
gfx::kDisabledControlAlpha);
}
-
return color;
}
« no previous file with comments | « ui/views/controls/focusable_border.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698