| 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/ui/views/tab_contents/native_tab_contents_view_gtk.h" | 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h" | 8 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h" |
| 9 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 9 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
| 10 #include "chrome/browser/ui/gtk/tab_contents_drag_source.h" | 10 #include "chrome/browser/ui/gtk/tab_contents_drag_source.h" |
| 11 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" |
| 11 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" | 12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
| 12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h" | 13 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" | 14 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 15 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "content/browser/tab_contents/tab_contents_view.h" | 16 #include "content/browser/tab_contents/tab_contents_view.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 18 | 19 |
| 19 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 20 #include "chrome/browser/chromeos/login/user_manager.h" | 21 #include "chrome/browser/chromeos/login/user_manager.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 view->InitAsChild(); | 129 view->InitAsChild(); |
| 129 g_signal_connect(view->native_view(), "focus", | 130 g_signal_connect(view->native_view(), "focus", |
| 130 G_CALLBACK(OnFocus), delegate_->GetTabContents()); | 131 G_CALLBACK(OnFocus), delegate_->GetTabContents()); |
| 131 g_signal_connect(view->native_view(), "scroll-event", | 132 g_signal_connect(view->native_view(), "scroll-event", |
| 132 G_CALLBACK(OnMouseScroll), delegate_); | 133 G_CALLBACK(OnMouseScroll), delegate_); |
| 133 | 134 |
| 134 // Let widget know that the tab contents has been painted. | 135 // Let widget know that the tab contents has been painted. |
| 135 views::NativeWidgetGtk::RegisterChildExposeHandler(view->native_view()); | 136 views::NativeWidgetGtk::RegisterChildExposeHandler(view->native_view()); |
| 136 | 137 |
| 137 // Renderer target DnD. | 138 // Renderer target DnD. |
| 138 if (delegate_->GetTabContents()->ShouldAcceptDragAndDrop()) | 139 if (delegate_->GetTabContents()->ShouldAcceptDragAndDrop()) { |
| 139 drag_dest_.reset(new WebDragDestGtk(delegate_->GetTabContents(), | 140 drag_dest_.reset(new WebDragDestGtk(delegate_->GetTabContents(), |
| 140 view->native_view())); | 141 view->native_view())); |
| 142 bookmark_handler_gtk_.reset(new WebDragBookmarkHandlerGtk); |
| 143 drag_dest_->set_delegate(bookmark_handler_gtk_.get()); |
| 144 } |
| 141 | 145 |
| 142 gtk_fixed_put(GTK_FIXED(GetWidget()->GetNativeView()), view->native_view(), 0, | 146 gtk_fixed_put(GTK_FIXED(GetWidget()->GetNativeView()), view->native_view(), 0, |
| 143 0); | 147 0); |
| 144 return view; | 148 return view; |
| 145 } | 149 } |
| 146 | 150 |
| 147 gfx::NativeWindow NativeTabContentsViewGtk::GetTopLevelNativeWindow() const { | 151 gfx::NativeWindow NativeTabContentsViewGtk::GetTopLevelNativeWindow() const { |
| 148 GtkWidget* window = gtk_widget_get_ancestor(GetWidget()->GetNativeView(), | 152 GtkWidget* window = gtk_widget_get_ancestor(GetWidget()->GetNativeView(), |
| 149 GTK_TYPE_WINDOW); | 153 GTK_TYPE_WINDOW); |
| 150 return window ? GTK_WINDOW(window) : NULL; | 154 return window ? GTK_WINDOW(window) : NULL; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 //////////////////////////////////////////////////////////////////////////////// | 274 //////////////////////////////////////////////////////////////////////////////// |
| 271 // NativeTabContentsView, public: | 275 // NativeTabContentsView, public: |
| 272 | 276 |
| 273 // static | 277 // static |
| 274 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( | 278 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( |
| 275 internal::NativeTabContentsViewDelegate* delegate) { | 279 internal::NativeTabContentsViewDelegate* delegate) { |
| 276 if (views::Widget::IsPureViews()) | 280 if (views::Widget::IsPureViews()) |
| 277 return new NativeTabContentsViewViews(delegate); | 281 return new NativeTabContentsViewViews(delegate); |
| 278 return new NativeTabContentsViewGtk(delegate); | 282 return new NativeTabContentsViewGtk(delegate); |
| 279 } | 283 } |
| OLD | NEW |