| 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 "chrome/views/menu.h" | 5 #include "chrome/views/menu.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcrack.h> | 8 #include <atlcrack.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlframe.h> | 10 #include <atlframe.h> |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 547 |
| 548 for (size_t i = 0; i < submenus_.size(); ++i) | 548 for (size_t i = 0; i < submenus_.size(); ++i) |
| 549 submenus_[i]->SetMenuInfo(); | 549 submenus_[i]->SetMenuInfo(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void Menu::RunMenuAt(int x, int y) { | 552 void Menu::RunMenuAt(int x, int y) { |
| 553 SetMenuInfo(); | 553 SetMenuInfo(); |
| 554 | 554 |
| 555 delegate_->MenuWillShow(); | 555 delegate_->MenuWillShow(); |
| 556 | 556 |
| 557 // Show the menu. Blocks until the menu is dismissed or an item is chosen. | 557 // NOTE: we don't use TPM_RIGHTBUTTON here as it breaks selecting by way of |
| 558 // press, drag, release. See bugs 718 and 8560. |
| 558 UINT flags = | 559 UINT flags = |
| 559 GetTPMAlignFlags() | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_RECURSE; | 560 GetTPMAlignFlags() | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE; |
| 560 is_menu_visible_ = true; | 561 is_menu_visible_ = true; |
| 561 DCHECK(owner_); | 562 DCHECK(owner_); |
| 562 // In order for context menus on menus to work, the context menu needs to | 563 // In order for context menus on menus to work, the context menu needs to |
| 563 // share the same window as the first menu is parented to. | 564 // share the same window as the first menu is parented to. |
| 564 bool created_host = false; | 565 bool created_host = false; |
| 565 if (!active_host_window) { | 566 if (!active_host_window) { |
| 566 created_host = true; | 567 created_host = true; |
| 567 active_host_window = new MenuHostWindow(this, owner_); | 568 active_host_window = new MenuHostWindow(this, owner_); |
| 568 } | 569 } |
| 569 UINT selected_id = | 570 UINT selected_id = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 581 | 582 |
| 582 void Menu::Cancel() { | 583 void Menu::Cancel() { |
| 583 DCHECK(is_menu_visible_); | 584 DCHECK(is_menu_visible_); |
| 584 EndMenu(); | 585 EndMenu(); |
| 585 } | 586 } |
| 586 | 587 |
| 587 int Menu::ItemCount() { | 588 int Menu::ItemCount() { |
| 588 return GetMenuItemCount(menu_); | 589 return GetMenuItemCount(menu_); |
| 589 } | 590 } |
| 590 | 591 |
| OLD | NEW |