OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "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/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 if (ViewsDelegate::views_delegate) | 312 if (ViewsDelegate::views_delegate) |
313 ViewsDelegate::views_delegate->AddRef(); | 313 ViewsDelegate::views_delegate->AddRef(); |
314 | 314 |
315 // We need to turn on nestable tasks as in some situations (pressing alt-f for | 315 // We need to turn on nestable tasks as in some situations (pressing alt-f for |
316 // one) the menus are run from a task. If we don't do this and are invoked | 316 // one) the menus are run from a task. If we don't do this and are invoked |
317 // from a task none of the tasks we schedule are processed and the menu | 317 // from a task none of the tasks we schedule are processed and the menu |
318 // appears totally broken. | 318 // appears totally broken. |
319 MessageLoopForUI* loop = MessageLoopForUI::current(); | 319 MessageLoopForUI* loop = MessageLoopForUI::current(); |
320 bool did_allow_task_nesting = loop->NestableTasksAllowed(); | 320 bool did_allow_task_nesting = loop->NestableTasksAllowed(); |
321 loop->SetNestableTasksAllowed(true); | 321 loop->SetNestableTasksAllowed(true); |
322 loop->Run(this); | 322 loop->RunWithDispatcher(this); |
323 loop->SetNestableTasksAllowed(did_allow_task_nesting); | 323 loop->SetNestableTasksAllowed(did_allow_task_nesting); |
324 | 324 |
325 if (ViewsDelegate::views_delegate) | 325 if (ViewsDelegate::views_delegate) |
326 ViewsDelegate::views_delegate->ReleaseRef(); | 326 ViewsDelegate::views_delegate->ReleaseRef(); |
327 | 327 |
328 // Close any open menus. | 328 // Close any open menus. |
329 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); | 329 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); |
330 | 330 |
331 if (nested_menu) { | 331 if (nested_menu) { |
332 DCHECK(!menu_stack_.empty()); | 332 DCHECK(!menu_stack_.empty()); |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 return; | 1960 return; |
1961 | 1961 |
1962 // Reset the active_mouse_view_ before sending mouse capture lost. That way if | 1962 // Reset the active_mouse_view_ before sending mouse capture lost. That way if |
1963 // it calls back to us, we aren't in a weird state. | 1963 // it calls back to us, we aren't in a weird state. |
1964 View* active_view = active_mouse_view_; | 1964 View* active_view = active_mouse_view_; |
1965 active_mouse_view_ = NULL; | 1965 active_mouse_view_ = NULL; |
1966 active_view->OnMouseCaptureLost(); | 1966 active_view->OnMouseCaptureLost(); |
1967 } | 1967 } |
1968 | 1968 |
1969 } // namespace views | 1969 } // namespace views |
OLD | NEW |