| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/common/shelf/shelf_button.h" | 5 #include "ash/common/shelf/shelf_button.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 465 } |
| 466 | 466 |
| 467 void ShelfButton::OnBlur() { | 467 void ShelfButton::OnBlur() { |
| 468 ClearState(STATE_FOCUSED); | 468 ClearState(STATE_FOCUSED); |
| 469 CustomButton::OnBlur(); | 469 CustomButton::OnBlur(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 void ShelfButton::OnPaint(gfx::Canvas* canvas) { | 472 void ShelfButton::OnPaint(gfx::Canvas* canvas) { |
| 473 CustomButton::OnPaint(canvas); | 473 CustomButton::OnPaint(canvas); |
| 474 if (HasFocus()) { | 474 if (HasFocus()) { |
| 475 gfx::Rect paint_bounds(GetLocalBounds()); | 475 canvas->DrawSolidFocusRect(gfx::RectF(GetLocalBounds()), kFocusBorderColor, |
| 476 paint_bounds.Inset(1, 1, 1, 1); | 476 kFocusBorderThickness); |
| 477 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor); | |
| 478 } | 477 } |
| 479 } | 478 } |
| 480 | 479 |
| 481 void ShelfButton::OnGestureEvent(ui::GestureEvent* event) { | 480 void ShelfButton::OnGestureEvent(ui::GestureEvent* event) { |
| 482 switch (event->type()) { | 481 switch (event->type()) { |
| 483 case ui::ET_GESTURE_TAP_DOWN: | 482 case ui::ET_GESTURE_TAP_DOWN: |
| 484 AddState(STATE_HOVERED); | 483 AddState(STATE_HOVERED); |
| 485 return CustomButton::OnGestureEvent(event); | 484 return CustomButton::OnGestureEvent(event); |
| 486 case ui::ET_GESTURE_END: | 485 case ui::ET_GESTURE_END: |
| 487 ClearState(STATE_HOVERED); | 486 ClearState(STATE_HOVERED); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 bar_->SetHorizontalAlignment(views::ImageView::TRAILING); | 596 bar_->SetHorizontalAlignment(views::ImageView::TRAILING); |
| 598 bar_->SetVerticalAlignment(views::ImageView::CENTER); | 597 bar_->SetVerticalAlignment(views::ImageView::CENTER); |
| 599 break; | 598 break; |
| 600 } | 599 } |
| 601 bar_->SchedulePaint(); | 600 bar_->SchedulePaint(); |
| 602 } | 601 } |
| 603 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 602 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
| 604 } | 603 } |
| 605 | 604 |
| 606 } // namespace ash | 605 } // namespace ash |
| OLD | NEW |