OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/native_menu_gtk.h" | 5 #include "views/controls/menu/native_menu_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Listen for "hide" signal so that we know when to return from the blocking | 117 // Listen for "hide" signal so that we know when to return from the blocking |
118 // RunMenuAt call. | 118 // RunMenuAt call. |
119 gint hide_handle_id = | 119 gint hide_handle_id = |
120 g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHiddenThunk), this); | 120 g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHiddenThunk), this); |
121 | 121 |
122 gint move_handle_id = | 122 gint move_handle_id = |
123 g_signal_connect(menu_, "move-current", | 123 g_signal_connect(menu_, "move-current", |
124 G_CALLBACK(OnMenuMoveCurrentThunk), this); | 124 G_CALLBACK(OnMenuMoveCurrentThunk), this); |
125 | 125 |
126 // Block until menu is no longer shown by running a nested message loop. | 126 // Block until menu is no longer shown by running a nested message loop. |
127 nested_dispatcher_ = new NestedDispatcherGtk(this, false); | 127 nested_dispatcher_ = new NestedDispatcherGtk(this, true); |
128 bool deleted = nested_dispatcher_->RunAndSelfDestruct(); | 128 bool deleted = nested_dispatcher_->RunAndSelfDestruct(); |
129 if (deleted) { | 129 if (deleted) { |
130 // The menu was destryed while menu is shown, so return immediately. | 130 // The menu was destryed while menu is shown, so return immediately. |
131 // Don't touch the instance which is already deleted. | 131 // Don't touch the instance which is already deleted. |
132 return; | 132 return; |
133 } | 133 } |
134 nested_dispatcher_ = NULL; | 134 nested_dispatcher_ = NULL; |
135 if (!menu_hidden_) { | 135 if (!menu_hidden_) { |
136 // If this happens it means we haven't yet gotten the hide signal and | 136 // If this happens it means we haven't yet gotten the hide signal and |
137 // someone else quit the message loop on us. | 137 // someone else quit the message loop on us. |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 #if !defined(OS_CHROMEOS) | 558 #if !defined(OS_CHROMEOS) |
559 | 559 |
560 // static | 560 // static |
561 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 561 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
562 return new NativeMenuGtk(menu); | 562 return new NativeMenuGtk(menu); |
563 } | 563 } |
564 | 564 |
565 #endif // OS_CHROMEOS | 565 #endif // OS_CHROMEOS |
566 | 566 |
567 } // namespace views | 567 } // namespace views |
OLD | NEW |