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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1569113002: MacViews: Style BUTTON_STYLE buttons using the "modern" UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix desktop linux weirdness Created 4 years, 8 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
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index fc07e0b7b0fa4bf42ef5db8e41cb481045232006..547f949b9a36cc0b2d2871e6c87802c5ae1cadfc 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -80,6 +80,7 @@ const CustomButton* CustomButton::AsCustomButton(const views::View* view) {
return AsCustomButton(const_cast<views::View*>(view));
}
+// static
CustomButton* CustomButton::AsCustomButton(views::View* view) {
if (view) {
const char* classname = view->GetClassName();
@@ -92,7 +93,26 @@ CustomButton* CustomButton::AsCustomButton(views::View* view) {
return static_cast<CustomButton*>(view);
}
}
- return NULL;
+ return nullptr;
+}
+
+// static
+const LabelButton* CustomButton::AsLabelButton(const views::View* view) {
+ return AsLabelButton(const_cast<views::View*>(view));
+}
+
+// static
+LabelButton* CustomButton::AsLabelButton(views::View* view) {
+ if (view) {
+ const char* classname = view->GetClassName();
+ if (!strcmp(classname, Checkbox::kViewClassName) ||
Elly Fong-Jones 2016/04/05 16:43:25 This seems a little weird... if anyone adds anothe
tapted 2016/04/06 12:08:33 Yeah I agree. However, this is the typical approac
+ !strcmp(classname, LabelButton::kViewClassName) ||
+ !strcmp(classname, RadioButton::kViewClassName) ||
+ !strcmp(classname, MenuButton::kViewClassName)) {
+ return static_cast<LabelButton*>(view);
+ }
+ }
+ return nullptr;
}
CustomButton::~CustomButton() {}

Powered by Google App Engine
This is Rietveld 408576698