OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/system/user/button_from_view.h" | 5 #include "ash/system/user/button_from_view.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
9 #include "ash/system/tray/tray_utils.h" | 9 #include "ash/system/tray/tray_utils.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 button_hovered_(false), | 36 button_hovered_(false), |
37 show_border_(false), | 37 show_border_(false), |
38 tab_frame_inset_(tab_frame_inset) { | 38 tab_frame_inset_(tab_frame_inset) { |
39 set_notify_enter_exit_on_child(true); | 39 set_notify_enter_exit_on_child(true); |
40 SetLayoutManager( | 40 SetLayoutManager( |
41 new views::BoxLayout(views::BoxLayout::kHorizontal, 1, 1, 0)); | 41 new views::BoxLayout(views::BoxLayout::kHorizontal, 1, 1, 0)); |
42 AddChildView(content_); | 42 AddChildView(content_); |
43 ShowActive(); | 43 ShowActive(); |
44 // Only make it focusable when we are active/interested in clicks. | 44 // Only make it focusable when we are active/interested in clicks. |
45 if (listener) | 45 if (listener) |
46 SetFocusBehavior(FocusBehavior::ALWAYS); | 46 Button::ConfigureDefaultFocus(this); |
47 } | 47 } |
48 | 48 |
49 ButtonFromView::~ButtonFromView() {} | 49 ButtonFromView::~ButtonFromView() {} |
50 | 50 |
51 void ButtonFromView::ForceBorderVisible(bool show) { | 51 void ButtonFromView::ForceBorderVisible(bool show) { |
52 show_border_ = show; | 52 show_border_ = show; |
53 ShowActive(); | 53 ShowActive(); |
54 } | 54 } |
55 | 55 |
56 void ButtonFromView::OnMouseEntered(const ui::MouseEvent& event) { | 56 void ButtonFromView::OnMouseEntered(const ui::MouseEvent& event) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; | 102 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; |
103 content_->set_background( | 103 content_->set_background( |
104 views::Background::CreateSolidBackground(background_color)); | 104 views::Background::CreateSolidBackground(background_color)); |
105 set_background(views::Background::CreateSolidBackground(background_color)); | 105 set_background(views::Background::CreateSolidBackground(background_color)); |
106 } | 106 } |
107 SchedulePaint(); | 107 SchedulePaint(); |
108 } | 108 } |
109 | 109 |
110 } // namespace tray | 110 } // namespace tray |
111 } // namespace ash | 111 } // namespace ash |
OLD | NEW |