| 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 "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 context_menu_callback = callback; | 218 context_menu_callback = callback; |
| 219 } | 219 } |
| 220 | 220 |
| 221 gfx::Size ToolbarActionView::GetPreferredSize() const { | 221 gfx::Size ToolbarActionView::GetPreferredSize() const { |
| 222 return gfx::Size(ToolbarActionsBar::IconWidth(false), | 222 return gfx::Size(ToolbarActionsBar::IconWidth(false), |
| 223 ToolbarActionsBar::IconHeight()); | 223 ToolbarActionsBar::IconHeight()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { | 226 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { |
| 227 // views::MenuButton actions are only triggered by left mouse clicks. | 227 // views::MenuButton actions are only triggered by left mouse clicks. |
| 228 if (event.IsOnlyLeftMouseButton()) | 228 if (event.IsOnlyLeftMouseButton()) { |
| 229 // TODO(bruthig): The ACTION_PENDING triggering logic should be in |
| 230 // MenuButton::OnPressed() however there is a bug with the pressed state |
| 231 // logic in MenuButton. See http://crbug.com/567252. |
| 229 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); | 232 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); |
| 233 } |
| 230 return MenuButton::OnMousePressed(event); | 234 return MenuButton::OnMousePressed(event); |
| 231 } | 235 } |
| 232 | 236 |
| 233 void ToolbarActionView::OnGestureEvent(ui::GestureEvent* event) { | 237 void ToolbarActionView::OnGestureEvent(ui::GestureEvent* event) { |
| 234 // While the dropdown menu is showing, the button should not handle gestures. | 238 // While the dropdown menu is showing, the button should not handle gestures. |
| 235 if (menu_) | 239 if (menu_) |
| 236 event->StopPropagation(); | 240 event->StopPropagation(); |
| 237 else | 241 else |
| 238 MenuButton::OnGestureEvent(event); | 242 MenuButton::OnGestureEvent(event); |
| 239 } | 243 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 if (menu_controller->in_nested_run()) { | 389 if (menu_controller->in_nested_run()) { |
| 386 // There is another menu showing. Close the outermost menu (since we are | 390 // There is another menu showing. Close the outermost menu (since we are |
| 387 // shown in the same menu, we don't want to close the whole thing). | 391 // shown in the same menu, we don't want to close the whole thing). |
| 388 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 392 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
| 389 return true; | 393 return true; |
| 390 } | 394 } |
| 391 } | 395 } |
| 392 | 396 |
| 393 return false; | 397 return false; |
| 394 } | 398 } |
| OLD | NEW |