summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
diff options
context:
space:
mode:
authortwiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 22:46:47 +0000
committertwiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 22:46:47 +0000
commit2db27be7dbb16f02587b90f150a843d8ad234563 (patch)
tree9bfd5b6b2ff4637a69744ce35249361d1f3ea353 /chrome/browser/renderer_host/render_widget_host_view_gtk.cc
parente1ce144bd04336891bb12b967095e938ed5f1bbb (diff)
downloadchromium_src-2db27be7dbb16f02587b90f150a843d8ad234563.zip
chromium_src-2db27be7dbb16f02587b90f150a843d8ad234563.tar.gz
chromium_src-2db27be7dbb16f02587b90f150a843d8ad234563.tar.bz2
CL implementing focus-dismissal of the chrome.experimental.popup set of extension APIs.
Specifically, these changes cause a displayed pop-up to be dismissed when the focus shifts away from both the pop-up view, and the extension-view that launched the pop-up.I had to do a lot of investigating and trial-and-error to converge to the solution present here. I was hoping to be able to piggy-back on the existing FocusManager's various listener routines, but because the pop-up is hosted in a BubbleWidget, which is a separate top-level window with its own focus manager, I could not rely on a given focus manager to take care of the focus change notifications. To get around the above issue, I added a new type of focus listener that can listen on native-window focus change events. I added invocations to this listener throughout the Widget classes in the system so that registered listeners will be notified on focus change. I found some of the focus change events problematic, as the system will arbitrarily reassign the focus to the main browser window when shifting activation between chrome windows. (SeefocusManagerWin::ClearNativeFocus). To prevent this focus bounce from confusing focus listeners, I added a means to suppress notification of focus change during these operations. I added GTK and Mac stubs for the new widget functions that will assert when called. GTK and Cocoa development is not my expertise, so I thought // TODO(port) would be wiser.I'm uncertain of the best means to unit-test these changes. Direction in this regard would be appreciated. BUG=None TEST=None Review URL: http://codereview.chromium.org/552167 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_widget_host_view_gtk.cc')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 66cbe52..dffb61f 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -43,6 +43,8 @@ static const int kMaxWindowHeight = 4000;
// TODO(brettw) make this a command line option.
static const bool kUseGPURendering = false;
+static const char* kRenderWidgetHostViewKey = "__RENDER_WIDGET_HOST_VIEW__";
+
using WebKit::WebInputEventFactory;
// This class is a simple convenience wrapper for Gtk functions. It has only
@@ -102,6 +104,9 @@ class RenderWidgetHostViewGtkWidget {
g_signal_connect_after(widget, "scroll-event",
G_CALLBACK(MouseScrollEvent), host_view);
+ g_object_set_data(G_OBJECT(widget), kRenderWidgetHostViewKey,
+ static_cast<RenderWidgetHostView*>(host_view));
+
return widget;
}
@@ -744,6 +749,14 @@ void RenderWidgetHostViewGtk::DestroyPluginContainer(
plugin_container_manager_.DestroyPluginContainer(id);
}
+bool RenderWidgetHostViewGtk::ContainsNativeView(
+ gfx::NativeView native_view) const {
+ // TODO(port)
+ NOTREACHED() <<
+ "RenderWidgetHostViewGtk::ContainsNativeView not implemented.";
+ return false;
+}
+
void RenderWidgetHostViewGtk::ForwardKeyboardEvent(
const NativeWebKeyboardEvent& event) {
if (!host_)
@@ -755,3 +768,12 @@ void RenderWidgetHostViewGtk::ForwardKeyboardEvent(
}
host_->ForwardKeyboardEvent(event);
}
+
+// static
+RenderWidgetHostView*
+ RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
+ gfx::NativeView widget) {
+ gpointer user_data = g_object_get_data(G_OBJECT(widget),
+ kRenderWidgetHostViewKey);
+ return reinterpret_cast<RenderWidgetHostView*>(user_data);
+}