OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/controls/menu/menu_controller.h" | 5 #include "views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/os_exchange_data.h" | 9 #include "app/os_exchange_data.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 SetSelection(pending_state_.item, open_submenu, true); | 432 SetSelection(pending_state_.item, open_submenu, true); |
433 gfx::Point loc(event.location()); | 433 gfx::Point loc(event.location()); |
434 View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc); | 434 View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc); |
435 | 435 |
436 // If we open a context menu just return now | 436 // If we open a context menu just return now |
437 if (part.menu->GetDelegate()->ShowContextMenu( | 437 if (part.menu->GetDelegate()->ShowContextMenu( |
438 part.menu, part.menu->GetCommand(), loc.x(), loc.y(), true)) | 438 part.menu, part.menu->GetCommand(), loc.x(), loc.y(), true)) |
439 return; | 439 return; |
440 } | 440 } |
441 | 441 |
442 if (!part.is_scroll() && part.menu && !part.menu->HasSubmenu()) { | 442 // We can use Ctrl+click or the middle mouse button to recursively open urls |
| 443 // for selected folder menu items. If it's only a left click, show the |
| 444 // contents of the folder. |
| 445 if (!part.is_scroll() && part.menu && !(part.menu->HasSubmenu() && |
| 446 (event.GetFlags() == MouseEvent::EF_LEFT_BUTTON_DOWN))) { |
443 if (part.menu->GetDelegate()->IsTriggerableEvent(event)) { | 447 if (part.menu->GetDelegate()->IsTriggerableEvent(event)) { |
444 Accept(part.menu, event.GetFlags()); | 448 Accept(part.menu, event.GetFlags()); |
445 return; | 449 return; |
446 } | 450 } |
447 } else if (part.type == MenuPart::MENU_ITEM) { | 451 } else if (part.type == MenuPart::MENU_ITEM) { |
448 // User either clicked on empty space, or a menu that has children. | 452 // User either clicked on empty space, or a menu that has children. |
449 SetSelection(part.menu ? part.menu : state_.item, true, true); | 453 SetSelection(part.menu ? part.menu : state_.item, true, true); |
450 } | 454 } |
451 } | 455 } |
452 | 456 |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 if (!scroll_task_.get()) | 1483 if (!scroll_task_.get()) |
1480 scroll_task_.reset(new MenuScrollTask()); | 1484 scroll_task_.reset(new MenuScrollTask()); |
1481 scroll_task_->Update(part); | 1485 scroll_task_->Update(part); |
1482 } | 1486 } |
1483 | 1487 |
1484 void MenuController::StopScrolling() { | 1488 void MenuController::StopScrolling() { |
1485 scroll_task_.reset(NULL); | 1489 scroll_task_.reset(NULL); |
1486 } | 1490 } |
1487 | 1491 |
1488 } // namespace views | 1492 } // namespace views |
OLD | NEW |