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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 // this actually is happening (and somebody isn't accidentally creating the | 121 // this actually is happening (and somebody isn't accidentally creating the |
122 // view twice), we check for the RVH Factory, which will be set when we're | 122 // view twice), we check for the RVH Factory, which will be set when we're |
123 // making special ones (which go along with the special views). | 123 // making special ones (which go along with the special views). |
124 DCHECK(RenderViewHostFactory::has_factory()); | 124 DCHECK(RenderViewHostFactory::has_factory()); |
125 return render_widget_host->GetView(); | 125 return render_widget_host->GetView(); |
126 } | 126 } |
127 | 127 |
128 RenderWidgetHostView* view = | 128 RenderWidgetHostView* view = |
129 RenderWidgetHostView::CreateViewForWidget(render_widget_host); | 129 RenderWidgetHostView::CreateViewForWidget(render_widget_host); |
130 view->InitAsChild(NULL); | 130 view->InitAsChild(NULL); |
131 if (render_widget_host->IsRenderView()) { | |
132 RenderViewHost* rvh = RenderViewHost::From(render_widget_host); | |
133 // A swapped out RenderViewHost is not visible, and so there is no reason | |
134 // to connect events to it, or use it as a WebDragDest (It won't be able | |
135 // to receive drag updates, and may break drag and drop in a window). | |
136 if (web_contents_->GetRenderManagerForTesting()->IsSwappedOut(rvh)) { | |
Fady Samuel
2013/02/13 21:15:22
This looks wrong...GetRenderManagerForTesting is s
Charlie Reis
2013/02/20 06:42:45
Fady's right-- this would be a layering violation.
| |
137 return view; | |
138 } | |
139 } | |
131 gfx::NativeView content_view = view->GetNativeView(); | 140 gfx::NativeView content_view = view->GetNativeView(); |
132 g_signal_connect(content_view, "focus", G_CALLBACK(OnFocusThunk), this); | 141 g_signal_connect(content_view, "focus", G_CALLBACK(OnFocusThunk), this); |
133 g_signal_connect(content_view, "leave-notify-event", | 142 g_signal_connect(content_view, "leave-notify-event", |
134 G_CALLBACK(OnLeaveNotify), web_contents_); | 143 G_CALLBACK(OnLeaveNotify), web_contents_); |
135 g_signal_connect(content_view, "motion-notify-event", | 144 g_signal_connect(content_view, "motion-notify-event", |
136 G_CALLBACK(OnMouseMove), web_contents_); | 145 G_CALLBACK(OnMouseMove), web_contents_); |
137 g_signal_connect(content_view, "scroll-event", | 146 g_signal_connect(content_view, "scroll-event", |
138 G_CALLBACK(OnMouseScroll), web_contents_); | 147 G_CALLBACK(OnMouseScroll), web_contents_); |
139 gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK | | 148 gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK | |
140 GDK_POINTER_MOTION_MASK); | 149 GDK_POINTER_MOTION_MASK); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 // We manually tell our RWHV to resize the renderer content. This avoids | 395 // We manually tell our RWHV to resize the renderer content. This avoids |
387 // spurious resizes from GTK+. | 396 // spurious resizes from GTK+. |
388 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 397 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
389 if (rwhv) | 398 if (rwhv) |
390 rwhv->SetSize(size); | 399 rwhv->SetSize(size); |
391 if (web_contents_->GetInterstitialPage()) | 400 if (web_contents_->GetInterstitialPage()) |
392 web_contents_->GetInterstitialPage()->SetSize(size); | 401 web_contents_->GetInterstitialPage()->SetSize(size); |
393 } | 402 } |
394 | 403 |
395 } // namespace content | 404 } // namespace content |
OLD | NEW |