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

Side by Side Diff: ui/views/controls/button/blue_button.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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/blue_button.h" 5 #include "ui/views/controls/button/blue_button.h"
6 6
7 #include "ui/base/resource/resource_bundle.h" 7 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/geometry/vector2d.h" 8 #include "ui/gfx/geometry/vector2d.h"
9 #include "ui/gfx/sys_color_change_listener.h" 9 #include "ui/gfx/sys_color_change_listener.h"
10 #include "ui/resources/grit/ui_resources.h" 10 #include "ui/resources/grit/ui_resources.h"
11 #include "ui/views/controls/button/label_button_border.h" 11 #include "ui/views/controls/button/label_button_border.h"
12 #include "ui/views/resources/grit/views_resources.h" 12 #include "ui/views/resources/grit/views_resources.h"
13 13
14 namespace views { 14 namespace views {
15 15
16 // static 16 // static
17 const char BlueButton::kViewClassName[] = "views/BlueButton"; 17 const char BlueButton::kViewClassName[] = "views/BlueButton";
18 18
19 BlueButton::BlueButton(ButtonListener* listener, const base::string16& text) 19 BlueButton::BlueButton(ButtonListener* listener, const base::string16& text)
20 : LabelButton(listener, text) { 20 : LabelButton(listener) {
21 // Inherit STYLE_BUTTON insets, minimum size, alignment, etc. 21 InitAsButton(text);
22 SetStyle(STYLE_BUTTON);
23 UpdateThemedBorder();
24 } 22 }
25 23
26 BlueButton::~BlueButton() {} 24 BlueButton::~BlueButton() {}
27 25
28 void BlueButton::ResetColorsFromNativeTheme() { 26 void BlueButton::ResetColorsFromNativeTheme() {
29 LabelButton::ResetColorsFromNativeTheme(); 27 LabelButton::ResetColorsFromNativeTheme();
30 if (!gfx::IsInvertedColorScheme()) { 28 if (!gfx::IsInvertedColorScheme()) {
31 SetTextColor(STATE_NORMAL, GetNativeTheme()-> 29 SetTextColor(STATE_NORMAL, GetNativeTheme()->
32 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonEnabledColor)); 30 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonEnabledColor));
33 SetTextColor(STATE_HOVERED, GetNativeTheme()-> 31 SetTextColor(STATE_HOVERED, GetNativeTheme()->
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 button_border->SetPainter(true, STATE_HOVERED, Painter::CreateImagePainter( 65 button_border->SetPainter(true, STATE_HOVERED, Painter::CreateImagePainter(
68 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_HOVER), insets)); 66 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_HOVER), insets));
69 button_border->SetPainter(true, STATE_PRESSED, Painter::CreateImagePainter( 67 button_border->SetPainter(true, STATE_PRESSED, Painter::CreateImagePainter(
70 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_PRESSED), insets)); 68 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_PRESSED), insets));
71 button_border->SetPainter(true, STATE_DISABLED, Painter::CreateImagePainter( 69 button_border->SetPainter(true, STATE_DISABLED, Painter::CreateImagePainter(
72 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_DISABLED), insets)); 70 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_DISABLED), insets));
73 return button_border.Pass(); 71 return button_border.Pass();
74 } 72 }
75 73
76 } // namespace views 74 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/blue_button.h ('k') | ui/views/controls/button/blue_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698