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

Unified Diff: ui/views/examples/textfield_example.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/examples/textfield_example.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/textfield_example.cc
diff --git a/ui/views/examples/textfield_example.cc b/ui/views/examples/textfield_example.cc
index 5b3144455d455426ed24b79e212ef4ce5558f6e4..98d806900587dc7840cb3dd793b28909b8e5f1ae 100644
--- a/ui/views/examples/textfield_example.cc
+++ b/ui/views/examples/textfield_example.cc
@@ -24,20 +24,19 @@ namespace views {
namespace examples {
TextfieldExample::TextfieldExample()
- : ExampleBase("Textfield"),
- name_(nullptr),
- password_(nullptr),
- disabled_(nullptr),
- read_only_(nullptr),
- show_password_(nullptr),
- clear_all_(nullptr),
- append_(nullptr),
- set_(nullptr),
- set_style_(nullptr) {
-}
-
-TextfieldExample::~TextfieldExample() {
-}
+ : ExampleBase("Textfield"),
+ name_(nullptr),
+ password_(nullptr),
+ disabled_(nullptr),
+ read_only_(nullptr),
+ invalid_(nullptr),
+ show_password_(nullptr),
+ clear_all_(nullptr),
+ append_(nullptr),
+ set_(nullptr),
+ set_style_(nullptr) {}
+
+TextfieldExample::~TextfieldExample() {}
void TextfieldExample::CreateExampleView(View* container) {
name_ = new Textfield();
@@ -50,6 +49,8 @@ void TextfieldExample::CreateExampleView(View* container) {
read_only_ = new Textfield();
read_only_->SetReadOnly(true);
read_only_->SetText(ASCIIToUTF16("read only"));
+ invalid_ = new Textfield();
+ invalid_->SetInvalid(true);
show_password_ = new LabelButton(this, ASCIIToUTF16("Show password"));
set_background_ =
new LabelButton(this, ASCIIToUTF16("Set non-default background"));
@@ -79,6 +80,7 @@ void TextfieldExample::CreateExampleView(View* container) {
MakeRow(new Label(ASCIIToUTF16("Password:")), password_);
MakeRow(new Label(ASCIIToUTF16("Disabled:")), disabled_);
MakeRow(new Label(ASCIIToUTF16("Read Only:")), read_only_);
+ MakeRow(new Label(ASCIIToUTF16("Invalid:")), invalid_);
MakeRow(new Label(ASCIIToUTF16("Name:")), nullptr);
MakeRow(show_password_, nullptr);
MakeRow(set_background_, nullptr);
@@ -121,16 +123,19 @@ void TextfieldExample::ButtonPressed(Button* sender, const ui::Event& event) {
password_->SetText(empty);
disabled_->SetText(empty);
read_only_->SetText(empty);
+ invalid_->SetText(empty);
} else if (sender == append_) {
name_->AppendText(ASCIIToUTF16("[append]"));
password_->AppendText(ASCIIToUTF16("[append]"));
disabled_->SetText(ASCIIToUTF16("[append]"));
read_only_->AppendText(ASCIIToUTF16("[append]"));
+ invalid_->AppendText(ASCIIToUTF16("[append]"));
} else if (sender == set_) {
name_->SetText(ASCIIToUTF16("[set]"));
password_->SetText(ASCIIToUTF16("[set]"));
disabled_->SetText(ASCIIToUTF16("[set]"));
read_only_->SetText(ASCIIToUTF16("[set]"));
+ invalid_->SetText(ASCIIToUTF16("[set]"));
} else if (sender == set_style_) {
if (!name_->text().empty()) {
name_->SetColor(SK_ColorGREEN);
« no previous file with comments | « ui/views/examples/textfield_example.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698