Commit 86d0649d authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Remove LabelButton::SetStyleDeprecated Calls from Button Example

BUG=897377
TBR=sky@chromium.org

Change-Id: Id565623ba035da1bc3e57688a5740eeabf4b08d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1634618Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664495}
parent 7e125622
...@@ -48,19 +48,13 @@ void ButtonExample::CreateExampleView(View* container) { ...@@ -48,19 +48,13 @@ void ButtonExample::CreateExampleView(View* container) {
label_button->set_request_focus_on_press(true); label_button->set_request_focus_on_press(true);
label_button_ = container->AddChildView(std::move(label_button)); label_button_ = container->AddChildView(std::move(label_button));
auto styled_button =
std::make_unique<LabelButton>(this, ASCIIToUTF16("Styled Button"));
styled_button->SetStyleDeprecated(Button::STYLE_BUTTON);
styled_button_ = container->AddChildView(std::move(styled_button));
auto disabled_button =
std::make_unique<LabelButton>(this, ASCIIToUTF16("Disabled Button"));
disabled_button->SetStyleDeprecated(Button::STYLE_BUTTON);
disabled_button->SetState(Button::STATE_DISABLED);
disabled_button_ = container->AddChildView(std::move(disabled_button));
md_button_ = container->AddChildView( md_button_ = container->AddChildView(
MdTextButton::Create(this, base::ASCIIToUTF16("Material design"))); MdTextButton::Create(this, base::ASCIIToUTF16("Material Design")));
auto md_disabled_button = MdTextButton::Create(
this, ASCIIToUTF16("Material Design Disabled Button"));
md_disabled_button->SetState(Button::STATE_DISABLED);
md_disabled_button_ = container->AddChildView(std::move(md_disabled_button));
auto md_default_button = auto md_default_button =
MdTextButton::Create(this, base::ASCIIToUTF16("Default")); MdTextButton::Create(this, base::ASCIIToUTF16("Default"));
...@@ -106,9 +100,6 @@ void ButtonExample::LabelButtonPressed(LabelButton* label_button, ...@@ -106,9 +100,6 @@ void ButtonExample::LabelButtonPressed(LabelButton* label_button,
label_button_->IsAccessibilityFocusable() label_button_->IsAccessibilityFocusable()
? label_button_->SetFocusBehavior(View::FocusBehavior::NEVER) ? label_button_->SetFocusBehavior(View::FocusBehavior::NEVER)
: label_button_->SetFocusForPlatform(); : label_button_->SetFocusForPlatform();
} else {
label_button->SetStyleDeprecated(static_cast<Button::ButtonStyle>(
(label_button->style() + 1) % Button::STYLE_COUNT));
} }
} else if (event.IsAltDown()) { } else if (event.IsAltDown()) {
label_button->SetIsDefault(!label_button->GetIsDefault()); label_button->SetIsDefault(!label_button->GetIsDefault());
...@@ -119,12 +110,10 @@ void ButtonExample::LabelButtonPressed(LabelButton* label_button, ...@@ -119,12 +110,10 @@ void ButtonExample::LabelButtonPressed(LabelButton* label_button,
void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) { void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) {
if (sender == label_button_) if (sender == label_button_)
LabelButtonPressed(label_button_, event); LabelButtonPressed(label_button_, event);
else if (sender == styled_button_)
LabelButtonPressed(styled_button_, event);
else if (sender == disabled_button_)
LabelButtonPressed(disabled_button_, event);
else if (sender == md_button_ || sender == md_default_button_) else if (sender == md_button_ || sender == md_default_button_)
static_cast<Button*>(sender)->StartThrobbing(5); static_cast<Button*>(sender)->StartThrobbing(5);
else if (sender == md_disabled_button_)
LabelButtonPressed(md_disabled_button_, event);
else else
PrintStatus("Image Button Pressed! count: %d", ++count_); PrintStatus("Image Button Pressed! count: %d", ++count_);
} }
......
...@@ -35,9 +35,8 @@ class VIEWS_EXAMPLES_EXPORT ButtonExample : public ExampleBase, ...@@ -35,9 +35,8 @@ class VIEWS_EXAMPLES_EXPORT ButtonExample : public ExampleBase,
// Example buttons. // Example buttons.
LabelButton* label_button_ = nullptr; LabelButton* label_button_ = nullptr;
LabelButton* styled_button_ = nullptr;
LabelButton* disabled_button_ = nullptr;
MdTextButton* md_button_ = nullptr; MdTextButton* md_button_ = nullptr;
MdTextButton* md_disabled_button_ = nullptr;
MdTextButton* md_default_button_ = nullptr; MdTextButton* md_default_button_ = nullptr;
ImageButton* image_button_ = nullptr; ImageButton* image_button_ = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment