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

Side by Side Diff: ui/message_center/views/notification_button.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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 | Annotate | Revision Log
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/message_center/views/notification_button.h" 5 #include "ui/message_center/views/notification_button.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/message_center/message_center_style.h" 8 #include "ui/message_center/message_center_style.h"
9 #include "ui/message_center/views/constants.h" 9 #include "ui/message_center/views/constants.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 64 title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
65 title_->SetEnabledColor(message_center::kRegularTextColor); 65 title_->SetEnabledColor(message_center::kRegularTextColor);
66 title_->SetBackgroundColor(kRegularTextBackgroundColor); 66 title_->SetBackgroundColor(kRegularTextBackgroundColor);
67 title_->SetBorder( 67 title_->SetBorder(
68 views::Border::CreateEmptyBorder(kButtonTitleTopPadding, 0, 0, 0)); 68 views::Border::CreateEmptyBorder(kButtonTitleTopPadding, 0, 0, 0));
69 AddChildView(title_); 69 AddChildView(title_);
70 } 70 }
71 SetAccessibleName(title); 71 SetAccessibleName(title);
72 } 72 }
73 73
74 gfx::Size NotificationButton::GetPreferredSize() { 74 gfx::Size NotificationButton::GetPreferredSize() const {
75 return gfx::Size(message_center::kNotificationWidth, 75 return gfx::Size(message_center::kNotificationWidth,
76 message_center::kButtonHeight); 76 message_center::kButtonHeight);
77 } 77 }
78 78
79 int NotificationButton::GetHeightForWidth(int width) { 79 int NotificationButton::GetHeightForWidth(int width) const {
80 return message_center::kButtonHeight; 80 return message_center::kButtonHeight;
81 } 81 }
82 82
83 void NotificationButton::OnPaint(gfx::Canvas* canvas) { 83 void NotificationButton::OnPaint(gfx::Canvas* canvas) {
84 CustomButton::OnPaint(canvas); 84 CustomButton::OnPaint(canvas);
85 views::Painter::PaintFocusPainter(this, canvas, focus_painter_.get()); 85 views::Painter::PaintFocusPainter(this, canvas, focus_painter_.get());
86 } 86 }
87 87
88 void NotificationButton::OnFocus() { 88 void NotificationButton::OnFocus() {
89 views::CustomButton::OnFocus(); 89 views::CustomButton::OnFocus();
(...skipping 11 matching lines...) Expand all
101 void NotificationButton::StateChanged() { 101 void NotificationButton::StateChanged() {
102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
103 set_background(views::Background::CreateSolidBackground( 103 set_background(views::Background::CreateSolidBackground(
104 message_center::kHoveredButtonBackgroundColor)); 104 message_center::kHoveredButtonBackgroundColor));
105 } else { 105 } else {
106 set_background(NULL); 106 set_background(NULL);
107 } 107 }
108 } 108 }
109 109
110 } // namespace message_center 110 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_button.h ('k') | ui/message_center/views/notification_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698