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/native_menu_win.h" | 5 #include "ui/views/controls/menu/native_menu_win.h" |
6 | 6 |
7 #include <Windowsx.h> | 7 #include <Windowsx.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 open_native_menu_win_ = NULL; | 448 open_native_menu_win_ = NULL; |
449 if (destroyed) | 449 if (destroyed) |
450 return; | 450 return; |
451 destroyed_flag_ = NULL; | 451 destroyed_flag_ = NULL; |
452 if (menu_to_select_) { | 452 if (menu_to_select_) { |
453 // Folks aren't too happy if we notify immediately. In particular, notifying | 453 // Folks aren't too happy if we notify immediately. In particular, notifying |
454 // the delegate can cause destruction leaving the stack in a weird | 454 // the delegate can cause destruction leaving the stack in a weird |
455 // state. Instead post a task, then notify. This mirrors what WM_MENUCOMMAND | 455 // state. Instead post a task, then notify. This mirrors what WM_MENUCOMMAND |
456 // does. | 456 // does. |
457 menu_to_select_factory_.InvalidateWeakPtrs(); | 457 menu_to_select_factory_.InvalidateWeakPtrs(); |
458 MessageLoop::current()->PostTask( | 458 base::MessageLoop::current()->PostTask( |
459 FROM_HERE, | 459 FROM_HERE, |
460 base::Bind(&NativeMenuWin::DelayedSelect, | 460 base::Bind(&NativeMenuWin::DelayedSelect, |
461 menu_to_select_factory_.GetWeakPtr())); | 461 menu_to_select_factory_.GetWeakPtr())); |
462 menu_action_ = MENU_ACTION_SELECTED; | 462 menu_action_ = MENU_ACTION_SELECTED; |
463 } | 463 } |
464 // Send MenuClosed after we schedule the select, otherwise MenuClosed is | 464 // Send MenuClosed after we schedule the select, otherwise MenuClosed is |
465 // processed after the select (MenuClosed posts a delayed task too). | 465 // processed after the select (MenuClosed posts a delayed task too). |
466 model_->MenuClosed(); | 466 model_->MenuClosed(); |
467 } | 467 } |
468 | 468 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 756 |
757 //////////////////////////////////////////////////////////////////////////////// | 757 //////////////////////////////////////////////////////////////////////////////// |
758 // MenuWrapper, public: | 758 // MenuWrapper, public: |
759 | 759 |
760 // static | 760 // static |
761 MenuWrapper* MenuWrapper::CreateWrapper(ui::MenuModel* model) { | 761 MenuWrapper* MenuWrapper::CreateWrapper(ui::MenuModel* model) { |
762 return new NativeMenuWin(model, NULL); | 762 return new NativeMenuWin(model, NULL); |
763 } | 763 } |
764 | 764 |
765 } // namespace views | 765 } // namespace views |
OLD | NEW |