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

Side by Side Diff: ash/common/system/tray/system_menu_button.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/system/tray/system_menu_button.h" 5 #include "ash/common/system/tray/system_menu_button.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/system/tray/system_tray.h" 8 #include "ash/common/system/tray/system_tray.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 12 matching lines...) Expand all
23 int accessible_name_id) 23 int accessible_name_id)
24 : views::ImageButton(listener), ink_drop_style_(ink_drop_style) { 24 : views::ImageButton(listener), ink_drop_style_(ink_drop_style) {
25 gfx::ImageSkia image = gfx::CreateVectorIcon(icon, kMenuIconColor); 25 gfx::ImageSkia image = gfx::CreateVectorIcon(icon, kMenuIconColor);
26 SetImage(views::Button::STATE_NORMAL, &image); 26 SetImage(views::Button::STATE_NORMAL, &image);
27 gfx::ImageSkia disabled_image = 27 gfx::ImageSkia disabled_image =
28 gfx::CreateVectorIcon(icon, kMenuIconColorDisabled); 28 gfx::CreateVectorIcon(icon, kMenuIconColorDisabled);
29 SetImage(views::Button::STATE_DISABLED, &disabled_image); 29 SetImage(views::Button::STATE_DISABLED, &disabled_image);
30 30
31 const int horizontal_padding = (kMenuButtonSize - image.width()) / 2; 31 const int horizontal_padding = (kMenuButtonSize - image.width()) / 2;
32 const int vertical_padding = (kMenuButtonSize - image.height()) / 2; 32 const int vertical_padding = (kMenuButtonSize - image.height()) / 2;
33 SetBorder( 33 SetBorder(views::CreateEmptyBorder(vertical_padding, horizontal_padding,
34 views::Border::CreateEmptyBorder(vertical_padding, horizontal_padding, 34 vertical_padding, horizontal_padding));
35 vertical_padding, horizontal_padding));
36 35
37 SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id)); 36 SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id));
38 37
39 // TODO(tdanderson): Update the focus rect color, border thickness, and 38 // TODO(tdanderson): Update the focus rect color, border thickness, and
40 // location for material design. 39 // location for material design.
41 SetFocusForPlatform(); 40 SetFocusForPlatform();
42 SetFocusPainter(views::Painter::CreateSolidFocusPainter( 41 SetFocusPainter(views::Painter::CreateSolidFocusPainter(
43 kFocusBorderColor, gfx::Insets(1, 1, 1, 1))); 42 kFocusBorderColor, gfx::Insets(1, 1, 1, 1)));
44 43
45 SetInkDropMode(InkDropMode::ON); 44 SetInkDropMode(InkDropMode::ON);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return false; 99 return false;
101 } 100 }
102 101
103 gfx::Size SystemMenuButton::GetInkDropSize() const { 102 gfx::Size SystemMenuButton::GetInkDropSize() const {
104 gfx::Rect bounds = GetLocalBounds(); 103 gfx::Rect bounds = GetLocalBounds();
105 bounds.Inset(kTrayPopupInkDropInset, kTrayPopupInkDropInset); 104 bounds.Inset(kTrayPopupInkDropInset, kTrayPopupInkDropInset);
106 return bounds.size(); 105 return bounds.size();
107 } 106 }
108 107
109 } // namespace ash 108 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/special_popup_row.cc ('k') | ash/common/system/tray/system_tray_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698