Home | History | Annotate | Download | only in tray
      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
      3 // found in the LICENSE file.
      4 
      5 #include "ash/system/tray/tray_popup_label_button.h"
      6 
      7 #include "ash/ash_constants.h"
      8 #include "ash/system/tray/tray_popup_label_button_border.h"
      9 #include "ui/gfx/canvas.h"
     10 #include "ui/gfx/rect.h"
     11 
     12 namespace ash {
     13 namespace internal {
     14 
     15 TrayPopupLabelButton::TrayPopupLabelButton(views::ButtonListener* listener,
     16                                            const base::string16& text)
     17     : views::LabelButton(listener, text) {
     18   set_border(new TrayPopupLabelButtonBorder);
     19   set_focusable(true);
     20   set_request_focus_on_press(false);
     21   set_animate_on_state_change(false);
     22   SetHorizontalAlignment(gfx::ALIGN_CENTER);
     23 }
     24 
     25 TrayPopupLabelButton::~TrayPopupLabelButton() {}
     26 
     27 void TrayPopupLabelButton::OnPaintFocusBorder(gfx::Canvas* canvas) {
     28   if (HasFocus() && (focusable() || IsAccessibilityFocusable())) {
     29     canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3),
     30                      ash::kFocusBorderColor);
     31   }
     32 }
     33 
     34 }  // namespace internal
     35 }  // namespace ash
     36