diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 15:54:51 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 15:54:51 +0000 |
commit | 759c8340d201169c8fcd6d7178a511085058a3ec (patch) | |
tree | 36e20d79bc2b60365752e3bbe6fcff1f7a632fa0 | |
parent | ddeaac4a79f5194c2cb98cd17e37810d00825333 (diff) | |
download | chromium_src-759c8340d201169c8fcd6d7178a511085058a3ec.zip chromium_src-759c8340d201169c8fcd6d7178a511085058a3ec.tar.gz chromium_src-759c8340d201169c8fcd6d7178a511085058a3ec.tar.bz2 |
Standardize warning color for requestAutocomplete
BUG=none
R=sky@chromium.org
Review URL: https://codereview.chromium.org/14583003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198731 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/autofill/autofill_dialog_types.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/autofill/autofill_dialog_types.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/autofill/autofill_dialog_types_unittest.cc | 20 | ||||
-rw-r--r-- | chrome/browser/ui/views/autofill/autofill_dialog_views.cc | 12 | ||||
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 1 | ||||
-rw-r--r-- | ui/native_theme/native_theme_base.cc | 2 | ||||
-rw-r--r-- | ui/views/color_constants.cc | 1 | ||||
-rw-r--r-- | ui/views/color_constants.h | 1 | ||||
-rw-r--r-- | ui/views/controls/combobox/native_combobox_views.cc | 5 |
9 files changed, 36 insertions, 12 deletions
diff --git a/chrome/browser/ui/autofill/autofill_dialog_types.cc b/chrome/browser/ui/autofill/autofill_dialog_types.cc index ce2aa5b..6829e37 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_types.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_types.cc @@ -28,7 +28,7 @@ SkColor DialogNotification::GetBackgroundColor() const { return SkColorSetRGB(0xfc, 0xf3, 0xbf); case DialogNotification::SECURITY_WARNING: case DialogNotification::VALIDATION_ERROR: - return SkColorSetRGB(0xde, 0x49, 0x32); + return kWarningColor; case DialogNotification::NONE: return SK_ColorTRANSPARENT; } @@ -68,6 +68,8 @@ bool DialogNotification::HasCheckbox() const { return type_ == DialogNotification::WALLET_USAGE_CONFIRMATION; } +SkColor const kWarningColor = SkColorSetRGB(0xde, 0x49, 0x32); + SuggestionState::SuggestionState(const string16& text, gfx::Font::FontStyle text_style, const gfx::Image& icon, diff --git a/chrome/browser/ui/autofill/autofill_dialog_types.h b/chrome/browser/ui/autofill/autofill_dialog_types.h index 9cd687d..e8e5693 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_types.h +++ b/chrome/browser/ui/autofill/autofill_dialog_types.h @@ -117,6 +117,8 @@ class DialogNotification { bool interactive_; }; +extern SkColor const kWarningColor; + enum DialogSignedInState { REQUIRES_RESPONSE, REQUIRES_SIGN_IN, diff --git a/chrome/browser/ui/autofill/autofill_dialog_types_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_types_unittest.cc new file mode 100644 index 0000000..d024e18 --- /dev/null +++ b/chrome/browser/ui/autofill/autofill_dialog_types_unittest.cc @@ -0,0 +1,20 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/autofill/autofill_dialog_types.h" +#include "testing/gtest/include/gtest/gtest.h" + +#if defined(TOOLKIT_VIEWS) +#include "ui/views/color_constants.h" +#endif + +namespace autofill { + +#if defined(TOOLKIT_VIEWS) +TEST(AutofillDialogTypesTest, WarningColorMatches) { + EXPECT_EQ(kWarningColor, views::kWarningColor); +} +#endif + +} // namespace autofill diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc index e048444..7f96658 100644 --- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc @@ -175,11 +175,7 @@ class SectionRowView : public views::View { class ErrorBubbleContents : public views::View { public: explicit ErrorBubbleContents(const string16& message) - : color_(SK_ColorWHITE) { - DialogNotification notification(DialogNotification::VALIDATION_ERROR, - string16()); - color_ = notification.GetBackgroundColor(); - + : color_(kWarningColor) { set_border(views::Border::CreateEmptyBorder(kArrowHeight, 0, 0, 0)); views::Label* label = new views::Label(); @@ -304,9 +300,8 @@ AutofillDialogViews::DecoratedTextfield::~DecoratedTextfield() {} void AutofillDialogViews::DecoratedTextfield::SetInvalid(bool invalid) { invalid_ = invalid; - // TODO(estade): Red is not exactly the right color. if (invalid) - textfield_->SetBorderColor(SK_ColorRED); + textfield_->SetBorderColor(kWarningColor); else textfield_->UseDefaultBorderColor(); SchedulePaint(); @@ -337,8 +332,7 @@ void AutofillDialogViews::DecoratedTextfield::OnPaint(gfx::Canvas* canvas) { dog_ear.lineTo(width(), kDogEarSize); dog_ear.close(); canvas->ClipPath(dog_ear); - // TODO(estade): Red is not exactly the right color. - canvas->DrawColor(SK_ColorRED); + canvas->DrawColor(kWarningColor); } } diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index db6dce7..a89a59f 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1256,6 +1256,7 @@ 'browser/ui/autofill/autocheckout_bubble_controller_unittest.cc', 'browser/ui/autofill/autofill_dialog_controller_unittest.cc', 'browser/ui/autofill/autofill_dialog_models_unittest.cc', + 'browser/ui/autofill/autofill_dialog_types_unittest.cc', 'browser/ui/autofill/autofill_popup_controller_unittest.cc', 'browser/ui/autofill/data_model_wrapper_unittest.cc', 'browser/ui/autofill/mock_autofill_dialog_controller.cc', diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc index 97961a1..6e64011 100644 --- a/ui/native_theme/native_theme_base.cc +++ b/ui/native_theme/native_theme_base.cc @@ -67,6 +67,8 @@ const SkColor kCheckboxStrokeDisabledColor = SkColorSetARGB(0x59, 0, 0, 0); const SkColor kRadioDotColor = SkColorSetRGB(0x66, 0x66, 0x66); const SkColor kRadioDotDisabledColor = SkColorSetARGB(0x80, 0x66, 0x66, 0x66); +const SkColor kInputInvalidColor = SkColorSetRGB(0xde, 0x49, 0x32); + // Get lightness adjusted color. SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha, double lightness_amount) { diff --git a/ui/views/color_constants.cc b/ui/views/color_constants.cc index 07a6ecb..7e9aa58 100644 --- a/ui/views/color_constants.cc +++ b/ui/views/color_constants.cc @@ -7,5 +7,6 @@ namespace views { const SkColor kClientEdgeColor = SkColorSetRGB(210, 225, 246); +const SkColor kWarningColor = SkColorSetRGB(0xde, 0x49, 0x32); } // namespace views diff --git a/ui/views/color_constants.h b/ui/views/color_constants.h index fbcff9f..8bd7c03 100644 --- a/ui/views/color_constants.h +++ b/ui/views/color_constants.h @@ -11,6 +11,7 @@ namespace views { VIEWS_EXPORT extern const SkColor kClientEdgeColor; +VIEWS_EXPORT extern const SkColor kWarningColor; } // namespace views diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc index 919fd6c..b57623d 100644 --- a/ui/views/controls/combobox/native_combobox_views.cc +++ b/ui/views/controls/combobox/native_combobox_views.cc @@ -18,6 +18,7 @@ #include "ui/native_theme/native_theme.h" #include "ui/views/background.h" #include "ui/views/border.h" +#include "ui/views/color_constants.h" #include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/focusable_border.h" #include "ui/views/controls/menu/menu_runner.h" @@ -64,7 +65,7 @@ class InvalidBackground : public Background { gfx::Rect bounds(view->GetLocalBounds()); // Inset by 2 to leave 1 empty pixel between background and border. bounds.Inset(2, 2, 2, 2); - canvas->FillRect(bounds, SK_ColorRED); + canvas->FillRect(bounds, kWarningColor); } private: @@ -261,7 +262,7 @@ void NativeComboboxViews::SetFocus() { void NativeComboboxViews::ValidityStateChanged() { if (combobox_->invalid()) { - text_border_->SetColor(SK_ColorRED); + text_border_->SetColor(kWarningColor); set_background(new InvalidBackground()); } else { text_border_->UseDefaultColor(); |