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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 SetSelection(pending_state_.item, open_submenu, true); | 434 SetSelection(pending_state_.item, open_submenu, true); |
435 gfx::Point loc(event.location()); | 435 gfx::Point loc(event.location()); |
436 View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc); | 436 View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc); |
437 | 437 |
438 // If we open a context menu just return now | 438 // If we open a context menu just return now |
439 if (part.menu->GetDelegate()->ShowContextMenu( | 439 if (part.menu->GetDelegate()->ShowContextMenu( |
440 part.menu, part.menu->GetCommand(), loc.x(), loc.y(), true)) | 440 part.menu, part.menu->GetCommand(), loc.x(), loc.y(), true)) |
441 return; | 441 return; |
442 } | 442 } |
443 | 443 |
444 if (!part.is_scroll() && part.menu && !part.menu->HasSubmenu()) { | 444 // We can use Ctrl+click or the middle mouse button to recursively open urls |
| 445 // for selected folder menu items. If it's only a left click, show the |
| 446 // contents of the folder. |
| 447 if (!part.is_scroll() && part.menu && !(part.menu->HasSubmenu() && |
| 448 (event.GetFlags() == MouseEvent::EF_LEFT_BUTTON_DOWN))) { |
445 if (part.menu->GetDelegate()->IsTriggerableEvent(event)) { | 449 if (part.menu->GetDelegate()->IsTriggerableEvent(event)) { |
446 Accept(part.menu, event.GetFlags()); | 450 Accept(part.menu, event.GetFlags()); |
447 return; | 451 return; |
448 } | 452 } |
449 } else if (part.type == MenuPart::MENU_ITEM) { | 453 } else if (part.type == MenuPart::MENU_ITEM) { |
450 // User either clicked on empty space, or a menu that has children. | 454 // User either clicked on empty space, or a menu that has children. |
451 SetSelection(part.menu ? part.menu : state_.item, true, true); | 455 SetSelection(part.menu ? part.menu : state_.item, true, true); |
452 } | 456 } |
453 } | 457 } |
454 | 458 |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 if (!scroll_task_.get()) | 1408 if (!scroll_task_.get()) |
1405 scroll_task_.reset(new MenuScrollTask()); | 1409 scroll_task_.reset(new MenuScrollTask()); |
1406 scroll_task_->Update(part); | 1410 scroll_task_->Update(part); |
1407 } | 1411 } |
1408 | 1412 |
1409 void MenuController::StopScrolling() { | 1413 void MenuController::StopScrolling() { |
1410 scroll_task_.reset(NULL); | 1414 scroll_task_.reset(NULL); |
1411 } | 1415 } |
1412 | 1416 |
1413 } // namespace views | 1417 } // namespace views |
OLD | NEW |