OLD | NEW |
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 "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 <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/browser_shutdown.h" | 16 #include "chrome/browser/browser_shutdown.h" |
17 #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" | 17 #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" |
| 18 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" |
18 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h" | 19 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h" |
19 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 20 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
20 #include "chrome/browser/ui/gtk/gtk_util.h" | 21 #include "chrome/browser/ui/gtk/gtk_util.h" |
21 #include "chrome/browser/ui/gtk/sad_tab_gtk.h" | 22 #include "chrome/browser/ui/gtk/sad_tab_gtk.h" |
22 #include "chrome/browser/ui/gtk/tab_contents_drag_source.h" | 23 #include "chrome/browser/ui/gtk/tab_contents_drag_source.h" |
23 #include "content/browser/renderer_host/render_process_host.h" | 24 #include "content/browser/renderer_host/render_process_host.h" |
24 #include "content/browser/renderer_host/render_view_host.h" | 25 #include "content/browser/renderer_host/render_view_host.h" |
25 #include "content/browser/renderer_host/render_view_host_factory.h" | 26 #include "content/browser/renderer_host/render_view_host_factory.h" |
26 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" | 27 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
27 #include "content/browser/tab_contents/interstitial_page.h" | 28 #include "content/browser/tab_contents/interstitial_page.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 g_signal_connect(content_view, "motion-notify-event", | 148 g_signal_connect(content_view, "motion-notify-event", |
148 G_CALLBACK(OnMouseMove), tab_contents_); | 149 G_CALLBACK(OnMouseMove), tab_contents_); |
149 g_signal_connect(content_view, "scroll-event", | 150 g_signal_connect(content_view, "scroll-event", |
150 G_CALLBACK(OnMouseScroll), tab_contents_); | 151 G_CALLBACK(OnMouseScroll), tab_contents_); |
151 gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK | | 152 gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK | |
152 GDK_POINTER_MOTION_MASK); | 153 GDK_POINTER_MOTION_MASK); |
153 InsertIntoContentArea(content_view); | 154 InsertIntoContentArea(content_view); |
154 | 155 |
155 // Renderer target DnD. | 156 // Renderer target DnD. |
156 drag_dest_.reset(new WebDragDestGtk(tab_contents_, content_view)); | 157 drag_dest_.reset(new WebDragDestGtk(tab_contents_, content_view)); |
| 158 bookmark_handler_gtk_.reset(new WebDragBookmarkHandlerGtk); |
| 159 drag_dest_->set_delegate(bookmark_handler_gtk_.get()); |
157 | 160 |
158 return view; | 161 return view; |
159 } | 162 } |
160 | 163 |
161 gfx::NativeView TabContentsViewGtk::GetNativeView() const { | 164 gfx::NativeView TabContentsViewGtk::GetNativeView() const { |
162 return floating_.get(); | 165 return floating_.get(); |
163 } | 166 } |
164 | 167 |
165 gfx::NativeView TabContentsViewGtk::GetContentNativeView() const { | 168 gfx::NativeView TabContentsViewGtk::GetContentNativeView() const { |
166 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 169 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 g_value_set_int(&value, child_x); | 505 g_value_set_int(&value, child_x); |
503 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 506 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
504 widget, "x", &value); | 507 widget, "x", &value); |
505 | 508 |
506 int child_y = std::max((allocation->height - requisition.height) / 2, 0); | 509 int child_y = std::max((allocation->height - requisition.height) / 2, 0); |
507 g_value_set_int(&value, child_y); | 510 g_value_set_int(&value, child_y); |
508 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 511 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
509 widget, "y", &value); | 512 widget, "y", &value); |
510 g_value_unset(&value); | 513 g_value_unset(&value); |
511 } | 514 } |
OLD | NEW |