Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: views/controls/menu/menu_controller.cc

Issue 7250001: Refactor the glib message-pump, and use it as the base for a gtk message pump and an X message pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: media.gyp update Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/menu/menu_controller.h ('k') | views/controls/menu/nested_dispatcher_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 Cancel(EXIT_ALL); 851 Cancel(EXIT_ALL);
852 return false; 852 return false;
853 853
854 default: 854 default:
855 break; 855 break;
856 } 856 }
857 TranslateMessage(&msg); 857 TranslateMessage(&msg);
858 DispatchMessage(&msg); 858 DispatchMessage(&msg);
859 return exit_type_ == EXIT_NONE; 859 return exit_type_ == EXIT_NONE;
860 } 860 }
861 #elif defined(TOUCH_UI)
862 base::MessagePumpDispatcher::DispatchStatus
863 MenuController::Dispatch(XEvent* xev) {
864 if (!DispatchXEvent(xev))
865 return EVENT_IGNORED;
861 866
867 return exit_type_ != EXIT_NONE ?
868 base::MessagePumpDispatcher::EVENT_QUIT :
869 base::MessagePumpDispatcher::EVENT_PROCESSED;
870 }
862 #else 871 #else
863 bool MenuController::Dispatch(GdkEvent* event) { 872 bool MenuController::Dispatch(GdkEvent* event) {
864 if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) { 873 if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) {
865 gtk_main_do_event(event); 874 gtk_main_do_event(event);
866 return false; 875 return false;
867 } 876 }
868 877
869 switch (event->type) { 878 switch (event->type) {
870 case GDK_KEY_PRESS: { 879 case GDK_KEY_PRESS: {
871 ui::KeyboardCode win_keycode = 880 ui::KeyboardCode win_keycode =
(...skipping 18 matching lines...) Expand all
890 default: 899 default:
891 break; 900 break;
892 } 901 }
893 902
894 // We don't want Gtk to handle keyboard events, otherwise if they get 903 // We don't want Gtk to handle keyboard events, otherwise if they get
895 // handled by Gtk, unexpected behavior may occur. For example Tab key 904 // handled by Gtk, unexpected behavior may occur. For example Tab key
896 // may cause unexpected focus traversing. 905 // may cause unexpected focus traversing.
897 gtk_main_do_event(event); 906 gtk_main_do_event(event);
898 return exit_type_ == EXIT_NONE; 907 return exit_type_ == EXIT_NONE;
899 } 908 }
900
901 #if defined(TOUCH_UI)
902 base::MessagePumpGlibXDispatcher::DispatchStatus
903 MenuController::DispatchX(XEvent* xev) {
904 if (!DispatchXEvent(xev))
905 return EVENT_IGNORED;
906
907 return exit_type_ != EXIT_NONE ?
908 base::MessagePumpGlibXDispatcher::EVENT_QUIT :
909 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED;
910 }
911 #endif
912
913 #endif 909 #endif
914 910
915 bool MenuController::OnKeyDown(int key_code 911 bool MenuController::OnKeyDown(int key_code
916 #if defined(OS_WIN) 912 #if defined(OS_WIN)
917 , const MSG& msg 913 , const MSG& msg
918 #else 914 #else
919 #endif 915 #endif
920 ) { 916 ) {
921 DCHECK(blocking_run_); 917 DCHECK(blocking_run_);
922 918
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 return; 1878 return;
1883 1879
1884 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1880 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1885 // it calls back to us, we aren't in a weird state. 1881 // it calls back to us, we aren't in a weird state.
1886 View* active_view = active_mouse_view_; 1882 View* active_view = active_mouse_view_;
1887 active_mouse_view_ = NULL; 1883 active_mouse_view_ = NULL;
1888 active_view->OnMouseCaptureLost(); 1884 active_view->OnMouseCaptureLost();
1889 } 1885 }
1890 1886
1891 } // namespace views 1887 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_controller.h ('k') | views/controls/menu/nested_dispatcher_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698