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 other navigations that create views that may never be | |
Charlie Reis
2013/05/18 01:37:59
nit: that create non-swapped-out views that may ne
dcheng
2013/05/18 01:49:52
Done.
| |
233 // displayed, e.g. a navigation that turns into a download. | |
234 if (rvh == web_contents_->GetRenderViewHost()) { | |
235 DCHECK(!drag_dest_); | |
231 UpdateDragDest(rvh); | 236 UpdateDragDest(rvh); |
237 } | |
232 } | 238 } |
233 | 239 |
234 return view; | 240 return view; |
235 } | 241 } |
236 | 242 |
237 RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget( | 243 RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget( |
238 RenderWidgetHost* render_widget_host) { | 244 RenderWidgetHost* render_widget_host) { |
239 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); | 245 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); |
240 } | 246 } |
241 | 247 |
(...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 | 412 // We manually tell our RWHV to resize the renderer content. This avoids |
407 // spurious resizes from GTK+. | 413 // spurious resizes from GTK+. |
408 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 414 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
409 if (rwhv) | 415 if (rwhv) |
410 rwhv->SetSize(size); | 416 rwhv->SetSize(size); |
411 if (web_contents_->GetInterstitialPage()) | 417 if (web_contents_->GetInterstitialPage()) |
412 web_contents_->GetInterstitialPage()->SetSize(size); | 418 web_contents_->GetInterstitialPage()->SetSize(size); |
413 } | 419 } |
414 | 420 |
415 } // namespace content | 421 } // namespace content |
OLD | NEW |