Commit 30139034 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Distribute BoolToOnOff Away from ExampleBase

BoolToOnOff isn't generally useful to all examples.

BUG=897377
TBR=sky@chromium.org

Change-Id: Ic3738b32db1cd4f06651e5609f664b8aaa52943d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540365Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644585}
parent deccd500
......@@ -33,11 +33,6 @@ class VIEWS_EXAMPLES_EXPORT ExampleBase {
// Prints a message in the status area, at the bottom of the window.
void PrintStatus(const char* format, ...);
// Converts an boolean value to "on" or "off".
const char* BoolToOnOff(bool value) {
return value ? "on" : "off";
}
private:
// Name of the example - used as title in the combobox list.
std::string example_title_;
......
......@@ -54,7 +54,7 @@ void MessageBoxExample::CreateExampleView(View* container) {
void MessageBoxExample::ButtonPressed(Button* sender, const ui::Event& event) {
if (sender == status_) {
message_box_view_->SetCheckBoxLabel(
ASCIIToUTF16(BoolToOnOff(message_box_view_->IsCheckBoxSelected())));
ASCIIToUTF16(message_box_view_->IsCheckBoxSelected() ? "on" : "off"));
PrintStatus(message_box_view_->IsCheckBoxSelected() ?
"Check Box Selected" : "Check Box Not Selected");
} else if (sender == toggle_) {
......
......@@ -17,6 +17,14 @@
namespace views {
namespace examples {
namespace {
const char* BoolToOnOff(bool value) {
return value ? "on" : "off";
}
} // namespace
RadioButtonExample::RadioButtonExample() : ExampleBase("Radio Button") {}
RadioButtonExample::~RadioButtonExample() = default;
......
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