| 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 "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // TODO(erikkay): Run a nested modal loop while the mouse is down to | 186 // TODO(erikkay): Run a nested modal loop while the mouse is down to |
| 187 // enable menu-like drag-select behavior. | 187 // enable menu-like drag-select behavior. |
| 188 | 188 |
| 189 // The return value of this method is returned via OnMousePressed. | 189 // The return value of this method is returned via OnMousePressed. |
| 190 // We need to return false here since we're handing off focus to another | 190 // We need to return false here since we're handing off focus to another |
| 191 // widget/view, and true will grab it right back and try to send events | 191 // widget/view, and true will grab it right back and try to send events |
| 192 // to us. | 192 // to us. |
| 193 return false; | 193 return false; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void ToolbarActionView::OnMouseEntered(const ui::MouseEvent& event) { |
| 197 delegate_->OnMouseEnteredToolbarActionView(); |
| 198 views::MenuButton::OnMouseEntered(event); |
| 199 } |
| 200 |
| 196 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { | 201 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) { |
| 197 if (!event.IsRightMouseButton()) { | 202 if (!event.IsRightMouseButton()) { |
| 198 return view_controller_->HasPopup(GetCurrentWebContents()) ? | 203 return view_controller_->HasPopup(GetCurrentWebContents()) ? |
| 199 MenuButton::OnMousePressed(event) : LabelButton::OnMousePressed(event); | 204 MenuButton::OnMousePressed(event) : LabelButton::OnMousePressed(event); |
| 200 } | 205 } |
| 201 return false; | 206 return false; |
| 202 } | 207 } |
| 203 | 208 |
| 204 void ToolbarActionView::OnMouseReleased(const ui::MouseEvent& event) { | 209 void ToolbarActionView::OnMouseReleased(const ui::MouseEvent& event) { |
| 205 if (view_controller_->HasPopup(GetCurrentWebContents()) || IsMenuRunning()) { | 210 if (view_controller_->HasPopup(GetCurrentWebContents()) || IsMenuRunning()) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 if (!view_controller_->IsEnabled(GetCurrentWebContents())) { | 391 if (!view_controller_->IsEnabled(GetCurrentWebContents())) { |
| 387 // We should only get a button pressed event with a non-enabled action if | 392 // We should only get a button pressed event with a non-enabled action if |
| 388 // the left-click behavior should open the menu. | 393 // the left-click behavior should open the menu. |
| 389 DCHECK(view_controller_->DisabledClickOpensMenu()); | 394 DCHECK(view_controller_->DisabledClickOpensMenu()); |
| 390 context_menu_controller()->ShowContextMenuForView( | 395 context_menu_controller()->ShowContextMenuForView( |
| 391 this, menu_point, source_type); | 396 this, menu_point, source_type); |
| 392 } else { | 397 } else { |
| 393 view_controller_->ExecuteAction(true); | 398 view_controller_->ExecuteAction(true); |
| 394 } | 399 } |
| 395 } | 400 } |
| OLD | NEW |