| 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 "chrome/browser/ui/views/toolbar/toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 void ToolbarButton::OnMouseReleased(const ui::MouseEvent& event) { | 138 void ToolbarButton::OnMouseReleased(const ui::MouseEvent& event) { |
| 139 if (IsTriggerableEvent(event) || | 139 if (IsTriggerableEvent(event) || |
| 140 (event.IsRightMouseButton() && !HitTestPoint(event.location()))) { | 140 (event.IsRightMouseButton() && !HitTestPoint(event.location()))) { |
| 141 LabelButton::OnMouseReleased(event); | 141 LabelButton::OnMouseReleased(event); |
| 142 } | 142 } |
| 143 | 143 |
| 144 if (IsTriggerableEvent(event)) | 144 if (IsTriggerableEvent(event)) |
| 145 show_menu_factory_.InvalidateWeakPtrs(); | 145 show_menu_factory_.InvalidateWeakPtrs(); |
| 146 | 146 |
| 147 ink_drop_animation_controller_->AnimateToState(views::InkDropState::HIDDEN); | 147 if (!HitTestPoint(event.location())) |
| 148 ink_drop_animation_controller_->AnimateToState(views::InkDropState::HIDDEN); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void ToolbarButton::OnMouseCaptureLost() { | 151 void ToolbarButton::OnMouseCaptureLost() { |
| 151 } | 152 } |
| 152 | 153 |
| 153 void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) { | 154 void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) { |
| 154 // Starting a drag results in a MouseExited, we need to ignore it. | 155 // Starting a drag results in a MouseExited, we need to ignore it. |
| 155 // A right click release triggers an exit event. We want to | 156 // A right click release triggers an exit event. We want to |
| 156 // remain in a PUSHED state until the drop down menu closes. | 157 // remain in a PUSHED state until the drop down menu closes. |
| 157 if (state_ != STATE_DISABLED && !InDrag() && state_ != STATE_PRESSED) | 158 if (state_ != STATE_DISABLED && !InDrag() && state_ != STATE_PRESSED) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 SetState(STATE_NORMAL); | 342 SetState(STATE_NORMAL); |
| 342 } | 343 } |
| 343 | 344 |
| 344 gfx::Point ToolbarButton::CalculateInkDropCenter() const { | 345 gfx::Point ToolbarButton::CalculateInkDropCenter() const { |
| 345 return GetLocalBounds().CenterPoint(); | 346 return GetLocalBounds().CenterPoint(); |
| 346 } | 347 } |
| 347 | 348 |
| 348 const char* ToolbarButton::GetClassName() const { | 349 const char* ToolbarButton::GetClassName() const { |
| 349 return "ToolbarButton"; | 350 return "ToolbarButton"; |
| 350 } | 351 } |
| OLD | NEW |