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

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 (comments) 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
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 5d07d9bcf0e467e7a39e0e5cf097d86c7c09a2d4..b77ddc91cec3c97ec606d69060c3ad8c91d54d6a 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 {
@@ -246,6 +249,19 @@ 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);
+ toggle->SetBorder(views::CreateEmptyBorder(gfx::Insets(
+ kTrayToggleButtonVerticalPadding, kTrayToggleButtonHorizontalPadding)));
+ toggle->set_focus_painter(views::Painter::CreateSolidFocusPainter(
+ kFocusBorderColor, gfx::Insets(1)));
Evan Stade 2016/11/17 22:32:22 insets should be gfx::Insets(0,0,1,1) (CreateSolid
varkha 2016/11/17 22:51:54 This is probably the right thing to do but it need
+ toggle->SetFocusForPlatform();
Evan Stade 2016/11/17 22:32:22 seems like this should be part of the base ToggleB
varkha 2016/11/17 22:51:54 Done.
+ toggle->SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id));
Evan Stade 2016/11/17 22:32:22 This is a behavioral change. Terry and I decided a
varkha 2016/11/17 22:51:54 Done.
+ return toggle;
+}
+
void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) {
view->set_id(VIEW_ID_STICKY_HEADER);
view->set_background(

Powered by Google App Engine
This is Rietveld 408576698