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

Side by Side Diff: chrome/browser/ui/gtk/panels/panel_gtk.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
OLDNEW
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 "chrome/browser/ui/gtk/panels/panel_gtk.h" 5 #include "chrome/browser/ui/gtk/panels/panel_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include <X11/XF86keysym.h> 9 #include <X11/XF86keysym.h>
10 10
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 return TRUE; 710 return TRUE;
711 } 711 }
712 712
713 void PanelGtk::OnMainWindowDestroy(GtkWidget* widget) { 713 void PanelGtk::OnMainWindowDestroy(GtkWidget* widget) {
714 // BUG 8712. When we gtk_widget_destroy() in ClosePanel(), this will emit the 714 // BUG 8712. When we gtk_widget_destroy() in ClosePanel(), this will emit the
715 // signal right away, and we will be here (while ClosePanel() is still in the 715 // signal right away, and we will be here (while ClosePanel() is still in the
716 // call stack). Let stack unwind before deleting the panel. 716 // call stack). Let stack unwind before deleting the panel.
717 // 717 //
718 // We don't want to use DeleteSoon() here since it won't work on a nested pump 718 // We don't want to use DeleteSoon() here since it won't work on a nested pump
719 // (like in UI tests). 719 // (like in UI tests).
720 MessageLoop::current()->PostTask( 720 base::MessageLoop::current()->PostTask(
721 FROM_HERE, base::Bind(&base::DeletePointer<PanelGtk>, this)); 721 FROM_HERE, base::Bind(&base::DeletePointer<PanelGtk>, this));
722 } 722 }
723 723
724 void PanelGtk::ShowPanel() { 724 void PanelGtk::ShowPanel() {
725 gtk_window_present(window_); 725 gtk_window_present(window_);
726 RevealPanel(); 726 RevealPanel();
727 } 727 }
728 728
729 void PanelGtk::ShowPanelInactive() { 729 void PanelGtk::ShowPanelInactive() {
730 gtk_window_set_focus_on_map(window_, false); 730 gtk_window_set_focus_on_map(window_, false);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1054
1055 GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); 1055 GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
1056 event->button.button = 1; 1056 event->button.button = 1;
1057 event->button.x_root = mouse_location.x(); 1057 event->button.x_root = mouse_location.x();
1058 event->button.y_root = mouse_location.y(); 1058 event->button.y_root = mouse_location.y();
1059 if (modifier == panel::APPLY_TO_ALL) 1059 if (modifier == panel::APPLY_TO_ALL)
1060 event->button.state |= GDK_CONTROL_MASK; 1060 event->button.state |= GDK_CONTROL_MASK;
1061 panel_gtk_->OnTitlebarButtonPressEvent( 1061 panel_gtk_->OnTitlebarButtonPressEvent(
1062 NULL, reinterpret_cast<GdkEventButton*>(event)); 1062 NULL, reinterpret_cast<GdkEventButton*>(event));
1063 gdk_event_free(event); 1063 gdk_event_free(event);
1064 MessageLoopForUI::current()->RunUntilIdle(); 1064 base::MessageLoopForUI::current()->RunUntilIdle();
1065 } 1065 }
1066 1066
1067 void GtkNativePanelTesting::ReleaseMouseButtonTitlebar( 1067 void GtkNativePanelTesting::ReleaseMouseButtonTitlebar(
1068 panel::ClickModifier modifier) { 1068 panel::ClickModifier modifier) {
1069 GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE); 1069 GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE);
1070 event->button.button = 1; 1070 event->button.button = 1;
1071 if (modifier == panel::APPLY_TO_ALL) 1071 if (modifier == panel::APPLY_TO_ALL)
1072 event->button.state |= GDK_CONTROL_MASK; 1072 event->button.state |= GDK_CONTROL_MASK;
1073 if (panel_gtk_->drag_helper_.get()) { 1073 if (panel_gtk_->drag_helper_.get()) {
1074 panel_gtk_->drag_helper_->OnButtonReleaseEvent( 1074 panel_gtk_->drag_helper_->OnButtonReleaseEvent(
1075 NULL, reinterpret_cast<GdkEventButton*>(event)); 1075 NULL, reinterpret_cast<GdkEventButton*>(event));
1076 } else { 1076 } else {
1077 panel_gtk_->OnTitlebarButtonReleaseEvent( 1077 panel_gtk_->OnTitlebarButtonReleaseEvent(
1078 NULL, reinterpret_cast<GdkEventButton*>(event)); 1078 NULL, reinterpret_cast<GdkEventButton*>(event));
1079 } 1079 }
1080 gdk_event_free(event); 1080 gdk_event_free(event);
1081 MessageLoopForUI::current()->RunUntilIdle(); 1081 base::MessageLoopForUI::current()->RunUntilIdle();
1082 } 1082 }
1083 1083
1084 void GtkNativePanelTesting::DragTitlebar(const gfx::Point& mouse_location) { 1084 void GtkNativePanelTesting::DragTitlebar(const gfx::Point& mouse_location) {
1085 if (!panel_gtk_->drag_helper_.get()) 1085 if (!panel_gtk_->drag_helper_.get())
1086 return; 1086 return;
1087 GdkEvent* event = gdk_event_new(GDK_MOTION_NOTIFY); 1087 GdkEvent* event = gdk_event_new(GDK_MOTION_NOTIFY);
1088 event->motion.x_root = mouse_location.x(); 1088 event->motion.x_root = mouse_location.x();
1089 event->motion.y_root = mouse_location.y(); 1089 event->motion.y_root = mouse_location.y();
1090 panel_gtk_->drag_helper_->OnMouseMoveEvent( 1090 panel_gtk_->drag_helper_->OnMouseMoveEvent(
1091 NULL, reinterpret_cast<GdkEventMotion*>(event)); 1091 NULL, reinterpret_cast<GdkEventMotion*>(event));
1092 gdk_event_free(event); 1092 gdk_event_free(event);
1093 MessageLoopForUI::current()->RunUntilIdle(); 1093 base::MessageLoopForUI::current()->RunUntilIdle();
1094 } 1094 }
1095 1095
1096 void GtkNativePanelTesting::CancelDragTitlebar() { 1096 void GtkNativePanelTesting::CancelDragTitlebar() {
1097 if (!panel_gtk_->drag_helper_.get()) 1097 if (!panel_gtk_->drag_helper_.get())
1098 return; 1098 return;
1099 panel_gtk_->drag_helper_->OnGrabBrokenEvent(NULL, NULL); 1099 panel_gtk_->drag_helper_->OnGrabBrokenEvent(NULL, NULL);
1100 MessageLoopForUI::current()->RunUntilIdle(); 1100 base::MessageLoopForUI::current()->RunUntilIdle();
1101 } 1101 }
1102 1102
1103 void GtkNativePanelTesting::FinishDragTitlebar() { 1103 void GtkNativePanelTesting::FinishDragTitlebar() {
1104 if (!panel_gtk_->drag_helper_.get()) 1104 if (!panel_gtk_->drag_helper_.get())
1105 return; 1105 return;
1106 ReleaseMouseButtonTitlebar(panel::NO_MODIFIER); 1106 ReleaseMouseButtonTitlebar(panel::NO_MODIFIER);
1107 } 1107 }
1108 1108
1109 bool GtkNativePanelTesting::VerifyDrawingAttention() const { 1109 bool GtkNativePanelTesting::VerifyDrawingAttention() const {
1110 return panel_gtk_->IsDrawingAttention(); 1110 return panel_gtk_->IsDrawingAttention();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 default: 1152 default:
1153 NOTREACHED(); 1153 NOTREACHED();
1154 return false; 1154 return false;
1155 } 1155 }
1156 return gtk_widget_get_visible(button->widget()); 1156 return gtk_widget_get_visible(button->widget());
1157 } 1157 }
1158 1158
1159 panel::CornerStyle GtkNativePanelTesting::GetWindowCornerStyle() const { 1159 panel::CornerStyle GtkNativePanelTesting::GetWindowCornerStyle() const {
1160 return panel_gtk_->corner_style_; 1160 return panel_gtk_->corner_style_;
1161 } 1161 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/one_click_signin_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/process_singleton_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698