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

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

Issue 1216673005: views::LabelButton should not call virtual methods from its constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150703-Views-ButtonBorderRefactor
Patch Set: self review Created 5 years, 5 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/checkbox.cc
diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc
index e54616aac0bddc6998a55030ff71caf8a4272d68..495dd0cea929d2a8e2be3c70d2ff1f6a18f28758 100644
--- a/ui/views/controls/button/checkbox.cc
+++ b/ui/views/controls/button/checkbox.cc
@@ -17,15 +17,20 @@ namespace views {
const char Checkbox::kViewClassName[] = "Checkbox";
Checkbox::Checkbox(const base::string16& label)
- : LabelButton(NULL, label),
- checked_(false) {
+ : LabelButton(nullptr), checked_(false) {
SetHorizontalAlignment(gfx::ALIGN_LEFT);
- scoped_ptr<LabelButtonBorder> button_border(new LabelButtonBorder(style()));
+ scoped_ptr<LabelButtonBorder> button_border(
+ new LabelButtonBorder(STYLE_TEXTBUTTON));
button_border->SetPainter(false, STATE_HOVERED, NULL);
button_border->SetPainter(false, STATE_PRESSED, NULL);
// Inset the trailing side by a couple pixels for the focus border.
button_border->set_insets(gfx::Insets(0, 0, 0, 2));
SetBorder(button_border.Pass());
+
+ // TODO(tapted): Remove this. Checkbox has subclasses and Init() may call
+ // virtual methods.
+ InitAsTextbutton(label);
+
SetFocusable(true);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
« no previous file with comments | « ui/views/controls/button/blue_button_unittest.cc ('k') | ui/views/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698