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

Unified Diff: ash/common/system/tray/tray_popup_utils.cc

Issue 2506133003: [ash-md] Allows ToggleButton to have a border and adds focus rectangle (Closed)
Patch Set: [ash-md] Allows ToggleButton to have a border and adds focus rectangle (rebase) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/tray/tray_popup_utils.h ('k') | ui/views/controls/button/toggle_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/tray_popup_utils.cc
diff --git a/ash/common/system/tray/tray_popup_utils.cc b/ash/common/system/tray/tray_popup_utils.cc
index b36733ff40f357821de10b7d772116d7ae751301..a7cda5a74fec0bd57c525c16bb061856ee7a0b44 100644
--- a/ash/common/system/tray/tray_popup_utils.cc
+++ b/ash/common/system/tray/tray_popup_utils.cc
@@ -15,6 +15,7 @@
#include "ash/common/system/tray/tray_popup_label_button.h"
#include "ash/common/system/tray/tray_popup_label_button_border.h"
#include "ash/common/wm_shell.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/ink_drop_impl.h"
@@ -25,12 +26,14 @@
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/md_text_button.h"
+#include "ui/views/controls/button/toggle_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/separator.h"
#include "ui/views/controls/slider.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
+#include "ui/views/painter.h"
namespace ash {
@@ -251,6 +254,24 @@ views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) {
return slider;
}
+views::ToggleButton* TrayPopupUtils::CreateToggleButton(
+ views::ButtonListener* listener,
+ int accessible_name_id) {
+ views::ToggleButton* toggle = new views::ToggleButton(listener);
+ const gfx::Size toggle_size(toggle->GetPreferredSize());
+ const int vertical_padding = (kMenuButtonSize - toggle_size.height()) / 2;
+ const int horizontal_padding =
+ (kTrayToggleButtonWidth - toggle_size.width()) / 2;
+ toggle->SetBorder(views::CreateEmptyBorder(
+ gfx::Insets(vertical_padding, horizontal_padding)));
+ // TODO(tdanderson): Update the focus rect color, border thickness, and
+ // location for material design.
+ toggle->SetFocusPainter(views::Painter::CreateSolidFocusPainter(
+ kFocusBorderColor, gfx::Insets(1)));
+ toggle->SetAccessibleName(l10n_util::GetStringUTF16(accessible_name_id));
+ return toggle;
+}
+
void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) {
view->set_id(VIEW_ID_STICKY_HEADER);
view->set_background(
« no previous file with comments | « ash/common/system/tray/tray_popup_utils.h ('k') | ui/views/controls/button/toggle_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698