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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return gfx::Size(ToolbarActionsBar::IconWidth(false), | 184 return gfx::Size(ToolbarActionsBar::IconWidth(false), |
185 ToolbarActionsBar::IconHeight()); | 185 ToolbarActionsBar::IconHeight()); |
186 } | 186 } |
187 | 187 |
188 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { | 188 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { |
189 // views::MenuButton actions are only triggered by left mouse clicks. | 189 // views::MenuButton actions are only triggered by left mouse clicks. |
190 if (event.IsOnlyLeftMouseButton() && !pressed_lock_) { | 190 if (event.IsOnlyLeftMouseButton() && !pressed_lock_) { |
191 // TODO(bruthig): The ACTION_PENDING triggering logic should be in | 191 // TODO(bruthig): The ACTION_PENDING triggering logic should be in |
192 // MenuButton::OnPressed() however there is a bug with the pressed state | 192 // MenuButton::OnPressed() however there is a bug with the pressed state |
193 // logic in MenuButton. See http://crbug.com/567252. | 193 // logic in MenuButton. See http://crbug.com/567252. |
194 AnimateInkDrop(views::InkDropState::ACTION_PENDING); | 194 AnimateInkDrop(views::InkDropState::ACTION_PENDING, &event); |
195 } | 195 } |
196 return MenuButton::OnMousePressed(event); | 196 return MenuButton::OnMousePressed(event); |
197 } | 197 } |
198 | 198 |
199 void ToolbarActionView::OnGestureEvent(ui::GestureEvent* event) { | 199 void ToolbarActionView::OnGestureEvent(ui::GestureEvent* event) { |
200 // While the dropdown menu is showing, the button should not handle gestures. | 200 // While the dropdown menu is showing, the button should not handle gestures. |
201 if (menu_) | 201 if (menu_) |
202 event->StopPropagation(); | 202 event->StopPropagation(); |
203 else | 203 else |
204 MenuButton::OnGestureEvent(event); | 204 MenuButton::OnGestureEvent(event); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (menu_controller->in_nested_run()) { | 319 if (menu_controller->in_nested_run()) { |
320 // There is another menu showing. Close the outermost menu (since we are | 320 // There is another menu showing. Close the outermost menu (since we are |
321 // shown in the same menu, we don't want to close the whole thing). | 321 // shown in the same menu, we don't want to close the whole thing). |
322 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 322 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
323 return true; | 323 return true; |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 return false; | 327 return false; |
328 } | 328 } |
OLD | NEW |