| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/button/custom_button.h" | 5 #include "ui/views/controls/button/custom_button.h" |
| 6 | 6 |
| 7 #include "ui/accessibility/ax_view_state.h" | 7 #include "ui/accessibility/ax_view_state.h" |
| 8 #include "ui/base/material_design/material_design_controller.h" | 8 #include "ui/base/material_design/material_design_controller.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const int kFocusBorderOutset = -2; | 40 const int kFocusBorderOutset = -2; |
| 41 | 41 |
| 42 // The corner radius of the focus border roundrect. | 42 // The corner radius of the focus border roundrect. |
| 43 const int kFocusBorderCornerRadius = 3; | 43 const int kFocusBorderCornerRadius = 3; |
| 44 | 44 |
| 45 class MdFocusRing : public views::View { | 45 class MdFocusRing : public views::View { |
| 46 public: | 46 public: |
| 47 MdFocusRing() { | 47 MdFocusRing() { |
| 48 SetPaintToLayer(true); | 48 SetPaintToLayer(true); |
| 49 layer()->SetFillsBoundsOpaquely(false); | 49 layer()->SetFillsBoundsOpaquely(false); |
| 50 | |
| 51 // Don't accept input events. | |
| 52 SetEnabled(false); | |
| 53 } | 50 } |
| 54 ~MdFocusRing() override {} | 51 ~MdFocusRing() override {} |
| 55 | 52 |
| 53 bool CanProcessEventsWithinSubtree() const override { |
| 54 return false; |
| 55 } |
| 56 |
| 56 void OnPaint(gfx::Canvas* canvas) override { | 57 void OnPaint(gfx::Canvas* canvas) override { |
| 57 CustomButton::PaintMdFocusRing(canvas, this); | 58 CustomButton::PaintMdFocusRing(canvas, this); |
| 58 } | 59 } |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(MdFocusRing); | 62 DISALLOW_COPY_AND_ASSIGN(MdFocusRing); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace | 65 } // namespace |
| 65 | 66 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 Button::NotifyClick(event); | 508 Button::NotifyClick(event); |
| 508 } | 509 } |
| 509 | 510 |
| 510 void CustomButton::OnClickCanceled(const ui::Event& event) { | 511 void CustomButton::OnClickCanceled(const ui::Event& event) { |
| 511 if (ink_drop_delegate()) | 512 if (ink_drop_delegate()) |
| 512 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); | 513 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); |
| 513 Button::OnClickCanceled(event); | 514 Button::OnClickCanceled(event); |
| 514 } | 515 } |
| 515 | 516 |
| 516 } // namespace views | 517 } // namespace views |
| OLD | NEW |