| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/common/system/user/button_from_view.h" | 7 #include "ash/common/system/user/button_from_view.h" |
| 8 | 8 |
| 9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 void ButtonFromView::OnMouseExited(const ui::MouseEvent& event) { | 83 void ButtonFromView::OnMouseExited(const ui::MouseEvent& event) { |
| 84 button_hovered_ = false; | 84 button_hovered_ = false; |
| 85 ShowActive(); | 85 ShowActive(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void ButtonFromView::OnPaint(gfx::Canvas* canvas) { | 88 void ButtonFromView::OnPaint(gfx::Canvas* canvas) { |
| 89 View::OnPaint(canvas); | 89 View::OnPaint(canvas); |
| 90 if (HasFocus()) { | 90 if (HasFocus()) { |
| 91 gfx::RectF rect(GetLocalBounds()); | 91 gfx::RectF rect(GetLocalBounds()); |
| 92 if (MaterialDesignController::IsSystemTrayMenuMaterial()) | 92 bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); |
| 93 rect.Inset(gfx::InsetsF(0.5f)); | 93 if (!use_md) |
| 94 else | |
| 95 rect.Inset(gfx::InsetsF(tab_frame_inset_)); | 94 rect.Inset(gfx::InsetsF(tab_frame_inset_)); |
| 96 canvas->DrawSolidFocusRect(rect, kFocusBorderColor); | 95 canvas->DrawSolidFocusRect(rect, kFocusBorderColor, |
| 96 use_md ? kFocusBorderThickness : 1); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ButtonFromView::OnFocus() { | 100 void ButtonFromView::OnFocus() { |
| 101 View::OnFocus(); | 101 View::OnFocus(); |
| 102 // Adding focus frame. | 102 // Adding focus frame. |
| 103 SchedulePaint(); | 103 SchedulePaint(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ButtonFromView::OnBlur() { | 106 void ButtonFromView::OnBlur() { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; | 174 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; |
| 175 content_->set_background( | 175 content_->set_background( |
| 176 views::Background::CreateSolidBackground(background_color)); | 176 views::Background::CreateSolidBackground(background_color)); |
| 177 set_background(views::Background::CreateSolidBackground(background_color)); | 177 set_background(views::Background::CreateSolidBackground(background_color)); |
| 178 } | 178 } |
| 179 SchedulePaint(); | 179 SchedulePaint(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace tray | 182 } // namespace tray |
| 183 } // namespace ash | 183 } // namespace ash |
| OLD | NEW |