| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" | 
| 6 | 6 | 
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> | 
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> | 
| 9 | 9 | 
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" | 
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 301 void TabContentsViewGtk::HandleKeyboardEvent( | 301 void TabContentsViewGtk::HandleKeyboardEvent( | 
| 302     const NativeWebKeyboardEvent& event) { | 302     const NativeWebKeyboardEvent& event) { | 
| 303   // This may be an accelerator. Try to pass it on to our browser window | 303   // This may be an accelerator. Try to pass it on to our browser window | 
| 304   // to handle. | 304   // to handle. | 
| 305   GtkWindow* window = GetTopLevelNativeWindow(); | 305   GtkWindow* window = GetTopLevelNativeWindow(); | 
| 306   if (!window) { | 306   if (!window) { | 
| 307     NOTREACHED(); | 307     NOTREACHED(); | 
| 308     return; | 308     return; | 
| 309   } | 309   } | 
| 310 | 310 | 
|  | 311   // Filter out pseudo key events created by GtkIMContext signal handlers. | 
|  | 312   // Since GtkIMContext signal handlers don't use GdkEventKey objects, its | 
|  | 313   // |event.os_event| values are dummy values (or NULL.) | 
|  | 314   // We should filter out these pseudo key events to prevent unexpected | 
|  | 315   // behaviors caused by them. | 
|  | 316   if (event.type == WebKit::WebInputEvent::Char) | 
|  | 317     return; | 
|  | 318 | 
| 311   BrowserWindowGtk* browser_window = | 319   BrowserWindowGtk* browser_window = | 
| 312       BrowserWindowGtk::GetBrowserWindowForNativeWindow(window); | 320       BrowserWindowGtk::GetBrowserWindowForNativeWindow(window); | 
| 313   DCHECK(browser_window); | 321   DCHECK(browser_window); | 
| 314   browser_window->HandleAccelerator(event.os_event->keyval, | 322   browser_window->HandleAccelerator(event.os_event->keyval, | 
| 315       static_cast<GdkModifierType>(event.os_event->state)); | 323       static_cast<GdkModifierType>(event.os_event->state)); | 
| 316 } | 324 } | 
| 317 | 325 | 
| 318 void TabContentsViewGtk::Observe(NotificationType type, | 326 void TabContentsViewGtk::Observe(NotificationType type, | 
| 319                                  const NotificationSource& source, | 327                                  const NotificationSource& source, | 
| 320                                  const NotificationDetails& details) { | 328                                  const NotificationDetails& details) { | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 426     gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 434     gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 
| 427                                      widget, "x", &value); | 435                                      widget, "x", &value); | 
| 428 | 436 | 
| 429     int child_y = std::max(half_view_height - (requisition.height / 2), 0); | 437     int child_y = std::max(half_view_height - (requisition.height / 2), 0); | 
| 430     g_value_set_int(&value, child_y); | 438     g_value_set_int(&value, child_y); | 
| 431     gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 439     gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 
| 432                                      widget, "y", &value); | 440                                      widget, "y", &value); | 
| 433     g_value_unset(&value); | 441     g_value_unset(&value); | 
| 434   } | 442   } | 
| 435 } | 443 } | 
| OLD | NEW | 
|---|