| 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/web_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/web_contents_view_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 <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 TabContents* tab_contents) { | 29 TabContents* tab_contents) { |
| 30 if (GTK_WIDGET_HAS_FOCUS(widget)) | 30 if (GTK_WIDGET_HAS_FOCUS(widget)) |
| 31 return TRUE; | 31 return TRUE; |
| 32 | 32 |
| 33 gtk_widget_grab_focus(widget); | 33 gtk_widget_grab_focus(widget); |
| 34 bool reverse = focus == GTK_DIR_TAB_BACKWARD; | 34 bool reverse = focus == GTK_DIR_TAB_BACKWARD; |
| 35 tab_contents->SetInitialFocus(reverse); | 35 tab_contents->SetInitialFocus(reverse); |
| 36 return TRUE; | 36 return TRUE; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Whenever we lose focus, set the cursor back to that of our parent window, |
| 40 // which should be the default arrow. |
| 41 gboolean OnFocusOut(GtkWidget* widget, GdkEventFocus* event, void*) { |
| 42 gdk_window_set_cursor(widget->window, NULL); |
| 43 return FALSE; |
| 44 } |
| 45 |
| 39 // Callback used in WebContentsViewGtk::CreateViewForWidget(). | 46 // Callback used in WebContentsViewGtk::CreateViewForWidget(). |
| 40 void RemoveWidget(GtkWidget* widget, void* container) { | 47 void RemoveWidget(GtkWidget* widget, void* container) { |
| 41 gtk_container_remove(GTK_CONTAINER(container), widget); | 48 gtk_container_remove(GTK_CONTAINER(container), widget); |
| 42 } | 49 } |
| 43 | 50 |
| 44 } // namespace | 51 } // namespace |
| 45 | 52 |
| 46 // static | 53 // static |
| 47 WebContentsView* WebContentsView::Create(WebContents* web_contents) { | 54 WebContentsView* WebContentsView::Create(WebContents* web_contents) { |
| 48 return new WebContentsViewGtk(web_contents); | 55 return new WebContentsViewGtk(web_contents); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 } | 74 } |
| 68 | 75 |
| 69 RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( | 76 RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( |
| 70 RenderWidgetHost* render_widget_host) { | 77 RenderWidgetHost* render_widget_host) { |
| 71 DCHECK(!render_widget_host->view()); | 78 DCHECK(!render_widget_host->view()); |
| 72 RenderWidgetHostViewGtk* view = | 79 RenderWidgetHostViewGtk* view = |
| 73 new RenderWidgetHostViewGtk(render_widget_host); | 80 new RenderWidgetHostViewGtk(render_widget_host); |
| 74 gtk_widget_show(view->native_view()); | 81 gtk_widget_show(view->native_view()); |
| 75 g_signal_connect(view->native_view(), "focus", | 82 g_signal_connect(view->native_view(), "focus", |
| 76 G_CALLBACK(OnFocus), web_contents_); | 83 G_CALLBACK(OnFocus), web_contents_); |
| 84 g_signal_connect(view->native_view(), "focus-out-event", |
| 85 G_CALLBACK(OnFocusOut), NULL); |
| 77 gtk_container_foreach(GTK_CONTAINER(vbox_), RemoveWidget, vbox_); | 86 gtk_container_foreach(GTK_CONTAINER(vbox_), RemoveWidget, vbox_); |
| 78 gtk_box_pack_start(GTK_BOX(vbox_), view->native_view(), TRUE, TRUE, 0); | 87 gtk_box_pack_start(GTK_BOX(vbox_), view->native_view(), TRUE, TRUE, 0); |
| 79 return view; | 88 return view; |
| 80 } | 89 } |
| 81 | 90 |
| 82 gfx::NativeView WebContentsViewGtk::GetNativeView() const { | 91 gfx::NativeView WebContentsViewGtk::GetNativeView() const { |
| 83 return vbox_; | 92 return vbox_; |
| 84 } | 93 } |
| 85 | 94 |
| 86 gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { | 95 gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 const gfx::Rect& initial_pos, | 232 const gfx::Rect& initial_pos, |
| 224 bool user_gesture) { | 233 bool user_gesture) { |
| 225 NOTIMPLEMENTED(); | 234 NOTIMPLEMENTED(); |
| 226 } | 235 } |
| 227 | 236 |
| 228 void WebContentsViewGtk::ShowCreatedWidgetInternal( | 237 void WebContentsViewGtk::ShowCreatedWidgetInternal( |
| 229 RenderWidgetHostView* widget_host_view, | 238 RenderWidgetHostView* widget_host_view, |
| 230 const gfx::Rect& initial_pos) { | 239 const gfx::Rect& initial_pos) { |
| 231 NOTIMPLEMENTED(); | 240 NOTIMPLEMENTED(); |
| 232 } | 241 } |
| OLD | NEW |