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

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

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: fix cros build Created 3 years, 9 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/message_center/views/padded_button.h" 5 #include "ui/message_center/views/padded_button.h"
6 6
7 #include "ui/base/resource/resource_bundle.h" 7 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/message_center/message_center_style.h" 9 #include "ui/message_center/message_center_style.h"
10 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 10 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
11 #include "ui/views/animation/ink_drop_impl.h" 11 #include "ui/views/animation/ink_drop_impl.h"
12 #include "ui/views/background.h" 12 #include "ui/views/background.h"
13 #include "ui/views/border.h" 13 #include "ui/views/border.h"
14 #include "ui/views/controls/button/image_button.h"
15 #include "ui/views/painter.h" 14 #include "ui/views/painter.h"
16 15
17 namespace message_center { 16 namespace message_center {
18 17
19 PaddedButton::PaddedButton(views::ButtonListener* listener) 18 PaddedButton::PaddedButton(views::ImageButtonDelegate* listener)
20 : views::ImageButton(listener) { 19 : views::ImageButton(listener) {
21 SetFocusForPlatform(); 20 SetFocusForPlatform();
22 SetFocusPainter(views::Painter::CreateSolidFocusPainter( 21 SetFocusPainter(views::Painter::CreateSolidFocusPainter(
23 kFocusBorderColor, 22 kFocusBorderColor,
24 gfx::Insets(1, 2, 2, 2))); 23 gfx::Insets(1, 2, 2, 2)));
25 set_background(views::Background::CreateSolidBackground( 24 set_background(views::Background::CreateSolidBackground(
26 SkColorSetA(SK_ColorWHITE, 0.9 * 0xff))); 25 SkColorSetA(SK_ColorWHITE, 0.9 * 0xff)));
27 SetBorder(views::CreateEmptyBorder(gfx::Insets(kControlButtonBorderSize))); 26 SetBorder(views::CreateEmptyBorder(gfx::Insets(kControlButtonBorderSize)));
28 set_animate_on_state_change(false); 27 set_animate_on_state_change(false);
29 28
30 SetInkDropMode(InkDropMode::ON); 29 SetInkDropMode(InkDropMode::ON);
31 set_ink_drop_base_color(SkColorSetA(SK_ColorBLACK, 0.6 * 0xff)); 30 set_ink_drop_base_color(SkColorSetA(SK_ColorBLACK, 0.6 * 0xff));
32 } 31 }
33 32
34 std::unique_ptr<views::InkDrop> PaddedButton::CreateInkDrop() { 33 std::unique_ptr<views::InkDrop> PaddedButton::CreateInkDrop() {
35 auto ink_drop = CreateDefaultInkDropImpl(); 34 auto ink_drop = CreateDefaultInkDropImpl();
36 ink_drop->SetShowHighlightOnHover(false); 35 ink_drop->SetShowHighlightOnHover(false);
37 ink_drop->SetShowHighlightOnFocus(false); 36 ink_drop->SetShowHighlightOnFocus(false);
38 return std::move(ink_drop); 37 return std::move(ink_drop);
39 } 38 }
40 39
41 std::unique_ptr<views::InkDropRipple> PaddedButton::CreateInkDropRipple() 40 std::unique_ptr<views::InkDropRipple> PaddedButton::CreateInkDropRipple()
42 const { 41 const {
43 return base::MakeUnique<views::FloodFillInkDropRipple>( 42 return base::MakeUnique<views::FloodFillInkDropRipple>(
44 size(), GetInkDropCenterBasedOnLastEvent(), 43 size(), GetInkDropCenterBasedOnLastEvent(),
45 SkColorSetA(SK_ColorBLACK, 0.6 * 255), ink_drop_visible_opacity()); 44 SkColorSetA(SK_ColorBLACK, 0.6 * 255), ink_drop_visible_opacity());
46 } 45 }
47 46
48 } // namespace message_center 47 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698