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