Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_view_gtk.h" | 5 #include "content/browser/web_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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 g_signal_connect(content_view, "leave-notify-event", | 216 g_signal_connect(content_view, "leave-notify-event", |
| 217 G_CALLBACK(OnLeaveNotify), web_contents_); | 217 G_CALLBACK(OnLeaveNotify), web_contents_); |
| 218 g_signal_connect(content_view, "motion-notify-event", | 218 g_signal_connect(content_view, "motion-notify-event", |
| 219 G_CALLBACK(OnMouseMove), web_contents_); | 219 G_CALLBACK(OnMouseMove), web_contents_); |
| 220 g_signal_connect(content_view, "scroll-event", | 220 g_signal_connect(content_view, "scroll-event", |
| 221 G_CALLBACK(OnMouseScroll), web_contents_); | 221 G_CALLBACK(OnMouseScroll), web_contents_); |
| 222 gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK | | 222 gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK | |
| 223 GDK_POINTER_MOTION_MASK); | 223 GDK_POINTER_MOTION_MASK); |
| 224 InsertIntoContentArea(content_view); | 224 InsertIntoContentArea(content_view); |
| 225 | 225 |
| 226 // Renderer target DnD. | 226 if (render_widget_host->IsRenderView()) { |
| 227 drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view)); | 227 RenderViewHost* rvh = RenderViewHost::From(render_widget_host); |
| 228 // According to WebContentsImpl::RenderViewCreated, if the RVH is swapped | |
| 229 // out on creation then we are just creating a swapped-out RVH for the | |
| 230 // opener chain that won't be used for WebUI, so it won't be expected to | |
| 231 // receive any events. | |
|
Charlie Reis
2013/02/27 01:42:35
This comment doesn't make sense to me. First, cre
mthiesse
2013/02/27 14:57:13
Done.
| |
| 232 if (!static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out()) { | |
| 233 // Renderer target DnD. | |
| 234 drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view)); | |
| 228 | 235 |
| 229 if (delegate_.get()) | 236 if (delegate_.get()) |
| 230 drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); | 237 drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); |
| 238 } | |
| 239 } | |
| 231 | 240 |
| 232 return view; | 241 return view; |
| 233 } | 242 } |
| 234 | 243 |
| 235 RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget( | 244 RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget( |
| 236 RenderWidgetHost* render_widget_host) { | 245 RenderWidgetHost* render_widget_host) { |
| 237 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); | 246 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); |
| 238 } | 247 } |
| 239 | 248 |
| 240 void WebContentsViewGtk::SetPageTitle(const string16& title) { | 249 void WebContentsViewGtk::SetPageTitle(const string16& title) { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 255 // sizing information on to the renderer. | 264 // sizing information on to the renderer. |
| 256 requested_size_ = size; | 265 requested_size_ = size; |
| 257 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 266 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 258 if (rwhv) | 267 if (rwhv) |
| 259 rwhv->SetSize(size); | 268 rwhv->SetSize(size); |
| 260 } | 269 } |
| 261 | 270 |
| 262 void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) { | 271 void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) { |
| 263 } | 272 } |
| 264 | 273 |
| 265 void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* host) { | 274 void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* new_host, |
| 275 RenderViewHost* old_host) { | |
|
Charlie Reis
2013/02/27 01:42:35
Shouldn't we update drag_dest_ every time we get h
mthiesse
2013/02/27 14:57:13
No, if we update the drag_dest_ every time here, j
Charlie Reis
2013/02/27 20:01:44
This sounds like an issue with drag n drop, which
| |
| 276 // If we don't have a drag_dest yet, then we should set the drag test to the | |
| 277 // new RVH. | |
| 278 // Also, not sure if this ever happens, but if the renderViewHost we're | |
| 279 // swapping out is used by the drag_dest, then we need to reset the drag_dest | |
| 280 // to the new host. | |
| 281 if (!drag_dest_.get() || (old_host && | |
| 282 (old_host->GetView()->GetNativeView() == drag_dest_->widget()))) { | |
| 283 drag_dest_.reset(new WebDragDestGtk(web_contents_, | |
| 284 new_host->GetView()->GetNativeView())); | |
| 285 if (delegate_.get()) | |
| 286 drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); | |
| 287 } | |
| 266 } | 288 } |
| 267 | 289 |
| 268 WebContents* WebContentsViewGtk::web_contents() { | 290 WebContents* WebContentsViewGtk::web_contents() { |
| 269 return web_contents_; | 291 return web_contents_; |
| 270 } | 292 } |
| 271 | 293 |
| 272 void WebContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { | 294 void WebContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { |
| 273 drag_dest_->UpdateDragStatus(operation); | 295 drag_dest_->UpdateDragStatus(operation); |
| 274 } | 296 } |
| 275 | 297 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 // We manually tell our RWHV to resize the renderer content. This avoids | 404 // We manually tell our RWHV to resize the renderer content. This avoids |
| 383 // spurious resizes from GTK+. | 405 // spurious resizes from GTK+. |
| 384 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 406 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 385 if (rwhv) | 407 if (rwhv) |
| 386 rwhv->SetSize(size); | 408 rwhv->SetSize(size); |
| 387 if (web_contents_->GetInterstitialPage()) | 409 if (web_contents_->GetInterstitialPage()) |
| 388 web_contents_->GetInterstitialPage()->SetSize(size); | 410 web_contents_->GetInterstitialPage()->SetSize(size); |
| 389 } | 411 } |
| 390 | 412 |
| 391 } // namespace content | 413 } // namespace content |
| OLD | NEW |