Chromium Code Reviews| 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_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 void ToolbarActionView::set_context_menu_callback_for_testing( | 192 void ToolbarActionView::set_context_menu_callback_for_testing( |
| 193 base::Callback<void(ToolbarActionView*)>* callback) { | 193 base::Callback<void(ToolbarActionView*)>* callback) { |
| 194 context_menu_callback_for_test = callback; | 194 context_menu_callback_for_test = callback; |
| 195 } | 195 } |
| 196 | 196 |
| 197 gfx::Size ToolbarActionView::GetPreferredSize() const { | 197 gfx::Size ToolbarActionView::GetPreferredSize() const { |
| 198 return gfx::Size(ToolbarActionsBar::IconWidth(false), | 198 return gfx::Size(ToolbarActionsBar::IconWidth(false), |
| 199 ToolbarActionsBar::IconHeight()); | 199 ToolbarActionsBar::IconHeight()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void ToolbarActionView::OnMouseCaptureLost() { | |
|
Devlin
2016/03/01 15:00:59
Why is this in ToolbarActionView instead of a butt
varkha
2016/03/01 16:32:31
Yes, I thought so too but wasn't sure if there is
Evan Stade
2016/03/01 21:01:17
The problem is that MD ink drops (which provide ho
| |
| 203 MenuButton::OnMouseCaptureLost(); | |
| 204 if (IsHotTracked()) | |
| 205 SetState(STATE_NORMAL); | |
| 206 } | |
| 207 | |
| 202 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { | 208 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { |
| 203 // views::MenuButton actions are only triggered by left mouse clicks. | 209 // views::MenuButton actions are only triggered by left mouse clicks. |
| 204 if (event.IsOnlyLeftMouseButton()) { | 210 if (event.IsOnlyLeftMouseButton()) { |
| 205 // TODO(bruthig): The ACTION_PENDING triggering logic should be in | 211 // TODO(bruthig): The ACTION_PENDING triggering logic should be in |
| 206 // MenuButton::OnPressed() however there is a bug with the pressed state | 212 // MenuButton::OnPressed() however there is a bug with the pressed state |
| 207 // logic in MenuButton. See http://crbug.com/567252. | 213 // logic in MenuButton. See http://crbug.com/567252. |
| 208 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); | 214 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); |
| 209 } | 215 } |
| 210 return MenuButton::OnMousePressed(event); | 216 return MenuButton::OnMousePressed(event); |
| 211 } | 217 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 if (menu_controller->in_nested_run()) { | 340 if (menu_controller->in_nested_run()) { |
| 335 // There is another menu showing. Close the outermost menu (since we are | 341 // There is another menu showing. Close the outermost menu (since we are |
| 336 // shown in the same menu, we don't want to close the whole thing). | 342 // shown in the same menu, we don't want to close the whole thing). |
| 337 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 343 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
| 338 return true; | 344 return true; |
| 339 } | 345 } |
| 340 } | 346 } |
| 341 | 347 |
| 342 return false; | 348 return false; |
| 343 } | 349 } |
| OLD | NEW |