| 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 <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 G_CALLBACK(OnFocus), web_contents()); | 94 G_CALLBACK(OnFocus), web_contents()); |
| 95 g_signal_connect(view->native_view(), "leave-notify-event", | 95 g_signal_connect(view->native_view(), "leave-notify-event", |
| 96 G_CALLBACK(OnLeaveNotify), web_contents()); | 96 G_CALLBACK(OnLeaveNotify), web_contents()); |
| 97 g_signal_connect(view->native_view(), "motion-notify-event", | 97 g_signal_connect(view->native_view(), "motion-notify-event", |
| 98 G_CALLBACK(OnMouseMove), web_contents()); | 98 G_CALLBACK(OnMouseMove), web_contents()); |
| 99 gtk_widget_add_events(view->native_view(), GDK_LEAVE_NOTIFY_MASK | | 99 gtk_widget_add_events(view->native_view(), GDK_LEAVE_NOTIFY_MASK | |
| 100 GDK_POINTER_MOTION_MASK); | 100 GDK_POINTER_MOTION_MASK); |
| 101 g_signal_connect(view->native_view(), "button-press-event", | 101 g_signal_connect(view->native_view(), "button-press-event", |
| 102 G_CALLBACK(OnMouseDown), this); | 102 G_CALLBACK(OnMouseDown), this); |
| 103 gfx::RemoveAllChildren(vbox_.get()); | 103 gfx::RemoveAllChildren(vbox_.get()); |
| 104 gtk_box_pack_start(GTK_BOX(vbox_.get()), content_view_, TRUE, TRUE, 0); | |
| 105 return view; | 104 return view; |
| 106 } | 105 } |
| 107 | 106 |
| 108 gfx::NativeView WebContentsViewGtk::GetNativeView() const { | 107 gfx::NativeView WebContentsViewGtk::GetNativeView() const { |
| 109 return vbox_.get(); | 108 return vbox_.get(); |
| 110 } | 109 } |
| 111 | 110 |
| 112 gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { | 111 gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { |
| 113 return content_view_; | 112 return content_view_; |
| 114 } | 113 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
| 178 } | 177 } |
| 179 | 178 |
| 180 void WebContentsViewGtk::RestoreFocus() { | 179 void WebContentsViewGtk::RestoreFocus() { |
| 181 // TODO(estade): implement this function. | 180 // TODO(estade): implement this function. |
| 182 // For now just assume we are viewing the tab for the first time. | 181 // For now just assume we are viewing the tab for the first time. |
| 183 SetInitialFocus(); | 182 SetInitialFocus(); |
| 184 NOTIMPLEMENTED() << " -- need to restore the focus position on this page."; | 183 NOTIMPLEMENTED() << " -- need to restore the focus position on this page."; |
| 185 } | 184 } |
| 186 | 185 |
| 186 void WebContentsViewGtk::SetChildSize(RenderWidgetHostView* rwh_view) { |
| 187 // Packing the gtk widget in a container will cause a configure-event to be |
| 188 // sent to the widget. |
| 189 gtk_box_pack_start(GTK_BOX(vbox_.get()), content_view_, TRUE, TRUE, 0); |
| 190 } |
| 191 |
| 187 void WebContentsViewGtk::UpdateDragCursor(bool is_drop_target) { | 192 void WebContentsViewGtk::UpdateDragCursor(bool is_drop_target) { |
| 188 NOTIMPLEMENTED(); | 193 NOTIMPLEMENTED(); |
| 189 } | 194 } |
| 190 | 195 |
| 191 // This is called when we the renderer asks us to take focus back (i.e., it has | 196 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 192 // iterated past the last focusable element on the page). | 197 // iterated past the last focusable element on the page). |
| 193 void WebContentsViewGtk::TakeFocus(bool reverse) { | 198 void WebContentsViewGtk::TakeFocus(bool reverse) { |
| 194 web_contents()->delegate()->SetFocusToLocationBar(); | 199 web_contents()->delegate()->SetFocusToLocationBar(); |
| 195 } | 200 } |
| 196 | 201 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // TODO(port): remove me when the above NOTIMPLEMENTED is fixed. | 243 // TODO(port): remove me when the above NOTIMPLEMENTED is fixed. |
| 239 if (web_contents()->render_view_host()) | 244 if (web_contents()->render_view_host()) |
| 240 web_contents()->render_view_host()->DragSourceSystemDragEnded(); | 245 web_contents()->render_view_host()->DragSourceSystemDragEnded(); |
| 241 } | 246 } |
| 242 | 247 |
| 243 gboolean WebContentsViewGtk::OnMouseDown(GtkWidget* widget, | 248 gboolean WebContentsViewGtk::OnMouseDown(GtkWidget* widget, |
| 244 GdkEventButton* event, WebContentsViewGtk* view) { | 249 GdkEventButton* event, WebContentsViewGtk* view) { |
| 245 view->last_mouse_down_time_ = event->time; | 250 view->last_mouse_down_time_ = event->time; |
| 246 return FALSE; | 251 return FALSE; |
| 247 } | 252 } |
| OLD | NEW |