| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
| 6 | 6 |
| 7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 | 2256 |
| 2257 if (quit_now) | 2257 if (quit_now) |
| 2258 base::MessageLoop::current()->QuitNow(); | 2258 base::MessageLoop::current()->QuitNow(); |
| 2259 } | 2259 } |
| 2260 | 2260 |
| 2261 void MenuController::HandleMouseLocation(SubmenuView* source, | 2261 void MenuController::HandleMouseLocation(SubmenuView* source, |
| 2262 const gfx::Point& mouse_location) { | 2262 const gfx::Point& mouse_location) { |
| 2263 if (showing_submenu_) | 2263 if (showing_submenu_) |
| 2264 return; | 2264 return; |
| 2265 | 2265 |
| 2266 // Ignore mouse events if we're closing the menu. |
| 2267 if (exit_type_ != EXIT_NONE) |
| 2268 return; |
| 2269 |
| 2266 MenuPart part = GetMenuPart(source, mouse_location); | 2270 MenuPart part = GetMenuPart(source, mouse_location); |
| 2267 | 2271 |
| 2268 UpdateScrolling(part); | 2272 UpdateScrolling(part); |
| 2269 | 2273 |
| 2270 if (!blocking_run_) | 2274 if (!blocking_run_) |
| 2271 return; | 2275 return; |
| 2272 | 2276 |
| 2273 if (part.type == MenuPart::NONE && ShowSiblingMenu(source, mouse_location)) | 2277 if (part.type == MenuPart::NONE && ShowSiblingMenu(source, mouse_location)) |
| 2274 return; | 2278 return; |
| 2275 | 2279 |
| 2276 if (part.type == MenuPart::MENU_ITEM && part.menu) { | 2280 if (part.type == MenuPart::MENU_ITEM && part.menu) { |
| 2277 SetSelection(part.menu, SELECTION_OPEN_SUBMENU); | 2281 SetSelection(part.menu, SELECTION_OPEN_SUBMENU); |
| 2278 } else if (!part.is_scroll() && pending_state_.item && | 2282 } else if (!part.is_scroll() && pending_state_.item && |
| 2279 pending_state_.item->GetParentMenuItem() && | 2283 pending_state_.item->GetParentMenuItem() && |
| 2280 (!pending_state_.item->HasSubmenu() || | 2284 (!pending_state_.item->HasSubmenu() || |
| 2281 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2285 !pending_state_.item->GetSubmenu()->IsShowing())) { |
| 2282 // On exit if the user hasn't selected an item with a submenu, move the | 2286 // On exit if the user hasn't selected an item with a submenu, move the |
| 2283 // selection back to the parent menu item. | 2287 // selection back to the parent menu item. |
| 2284 SetSelection(pending_state_.item->GetParentMenuItem(), | 2288 SetSelection(pending_state_.item->GetParentMenuItem(), |
| 2285 SELECTION_OPEN_SUBMENU); | 2289 SELECTION_OPEN_SUBMENU); |
| 2286 } | 2290 } |
| 2287 } | 2291 } |
| 2288 | 2292 |
| 2289 } // namespace views | 2293 } // namespace views |
| OLD | NEW |