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 // We don't want to change any state in this class for swapped out RVHs | |
227 // because they will not be visible at this time. | |
228 if (render_widget_host->IsRenderView()) { | 226 if (render_widget_host->IsRenderView()) { |
229 RenderViewHost* rvh = RenderViewHost::From(render_widget_host); | 227 RenderViewHost* rvh = RenderViewHost::From(render_widget_host); |
230 if (!static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out()) | 228 // If |rvh| is already the current render view host for the web contents, we |
| 229 // need to initialize |drag_dest_| for drags to be properly handled. |
| 230 // Otherwise, |drag_dest_| will be updated in RenderViewSwappedIn. The |
| 231 // reason we can't simply check that this isn't a swapped-out view is |
| 232 // because there are navigations that create non-swapped-out views that may |
| 233 // never be displayed, e.g. a navigation that becomes a download. |
| 234 if (rvh == web_contents_->GetRenderViewHost()) { |
231 UpdateDragDest(rvh); | 235 UpdateDragDest(rvh); |
| 236 } |
232 } | 237 } |
233 | 238 |
234 return view; | 239 return view; |
235 } | 240 } |
236 | 241 |
237 RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget( | 242 RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget( |
238 RenderWidgetHost* render_widget_host) { | 243 RenderWidgetHost* render_widget_host) { |
239 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); | 244 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); |
240 } | 245 } |
241 | 246 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // We manually tell our RWHV to resize the renderer content. This avoids | 411 // We manually tell our RWHV to resize the renderer content. This avoids |
407 // spurious resizes from GTK+. | 412 // spurious resizes from GTK+. |
408 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 413 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
409 if (rwhv) | 414 if (rwhv) |
410 rwhv->SetSize(size); | 415 rwhv->SetSize(size); |
411 if (web_contents_->GetInterstitialPage()) | 416 if (web_contents_->GetInterstitialPage()) |
412 web_contents_->GetInterstitialPage()->SetSize(size); | 417 web_contents_->GetInterstitialPage()->SetSize(size); |
413 } | 418 } |
414 | 419 |
415 } // namespace content | 420 } // namespace content |
OLD | NEW |