summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authoranicolao@chromium.org <anicolao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 21:40:08 +0000
committeranicolao@chromium.org <anicolao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 21:40:08 +0000
commitee520884a87f24a5e34ef660657d49f2ec993f6e (patch)
treea0d3cdd0fd986d3ea5aacdc5592adcbb2eef87b3 /chrome/browser/views
parent9eeb35e21e43c6a91fe45b03feb9cf1d42b88b65 (diff)
downloadchromium_src-ee520884a87f24a5e34ef660657d49f2ec993f6e.zip
chromium_src-ee520884a87f24a5e34ef660657d49f2ec993f6e.tar.gz
chromium_src-ee520884a87f24a5e34ef660657d49f2ec993f6e.tar.bz2
Working on removing GTK for touch UI, by introducing a new
RenderWidgetHostViewViews class to replace RenderWidgetHostViewGtk in the case of TOUCH_UI. This change shouldn't affect non-TOUCH_UI builds and is not yet complete for a number of event types and corner cases, but is sufficient to get in so that work on the touch keyboard and touch events can proceed in parallel with GTK removal. BUG=none TEST=none Review URL: http://codereview.chromium.org/3415005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/extensions/extension_view.cc7
-rw-r--r--chrome/browser/views/notifications/balloon_view_host.cc11
-rw-r--r--chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc4
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.cc40
4 files changed, 62 insertions, 0 deletions
diff --git a/chrome/browser/views/extensions/extension_view.cc b/chrome/browser/views/extensions/extension_view.cc
index 062bc00..4ba38ca 100644
--- a/chrome/browser/views/extensions/extension_view.cc
+++ b/chrome/browser/views/extensions/extension_view.cc
@@ -12,6 +12,8 @@
#if defined(OS_WIN)
#include "chrome/browser/renderer_host/render_widget_host_view_win.h"
+#elif defined(TOUCH_UI)
+#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
#elif defined(OS_LINUX)
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#endif
@@ -100,6 +102,11 @@ void ExtensionView::CreateWidgetHostView() {
HWND hwnd = view_win->Create(GetWidget()->GetNativeView());
view_win->ShowWindow(SW_SHOW);
Attach(hwnd);
+#elif defined(TOUCH_UI)
+ RenderWidgetHostViewViews* view_views =
+ static_cast<RenderWidgetHostViewViews*>(view);
+ view_views->InitAsChild();
+ Attach(view_views->GetNativeView());
#elif defined(OS_LINUX)
RenderWidgetHostViewGtk* view_gtk =
static_cast<RenderWidgetHostViewGtk*>(view);
diff --git a/chrome/browser/views/notifications/balloon_view_host.cc b/chrome/browser/views/notifications/balloon_view_host.cc
index b2c2a5c..24a7fe2 100644
--- a/chrome/browser/views/notifications/balloon_view_host.cc
+++ b/chrome/browser/views/notifications/balloon_view_host.cc
@@ -11,8 +11,12 @@
#include "chrome/browser/renderer_host/render_widget_host_view_win.h"
#endif
#if defined(OS_LINUX)
+#if defined(TOUCH_UI)
+#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
+#else
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#endif
+#endif
#include "views/widget/widget.h"
#if defined(OS_WIN)
#include "views/widget/widget_win.h"
@@ -71,10 +75,17 @@ void BalloonViewHost::InitRenderWidgetHostView() {
view_win->ShowWindow(SW_SHOW);
native_host_->Attach(hwnd);
#elif defined(OS_LINUX)
+#if defined(TOUCH_UI)
+ RenderWidgetHostViewViews* view_views =
+ static_cast<RenderWidgetHostViewViews*>(render_widget_host_view_);
+ view_views->InitAsChild();
+ native_host_->Attach(view_views->native_view());
+#else
RenderWidgetHostViewGtk* view_gtk =
static_cast<RenderWidgetHostViewGtk*>(render_widget_host_view_);
view_gtk->InitAsChild();
native_host_->Attach(view_gtk->native_view());
+#endif
#else
NOTIMPLEMENTED();
#endif
diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
index d9c26c5..0c07fa7 100644
--- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
+++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc
@@ -59,6 +59,7 @@ views::View* NativeTabContentsContainerGtk::GetView() {
void NativeTabContentsContainerGtk::TabContentsFocused(
TabContents* tab_contents) {
+#if !defined(TOUCH_UI)
// Called when the tab contents native view gets focused (typically through a
// user click). We make ourself the focused view, so the focus is restored
// properly when the browser window is deactivated/reactivated.
@@ -68,6 +69,9 @@ void NativeTabContentsContainerGtk::TabContentsFocused(
return;
}
focus_manager->SetFocusedView(this);
+#else
+ // no native views in TOUCH_UI, so don't steal the focus
+#endif
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
index c261600..e13d441 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
@@ -14,7 +14,11 @@
#include "chrome/browser/gtk/tab_contents_drag_source.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_view_host_factory.h"
+#if defined(TOUCH_UI)
+#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
+#else
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
+#endif
#include "chrome/browser/tab_contents/interstitial_page.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
@@ -174,6 +178,30 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget(
sad_tab_ = NULL;
}
+#if defined(TOUCH_UI)
+ RenderWidgetHostViewViews* view =
+ new RenderWidgetHostViewViews(render_widget_host);
+ SetContentsView(view);
+ view->Show();
+ view->InitAsChild();
+
+ g_signal_connect(view->native_view(), "focus",
+ G_CALLBACK(OnFocus), tab_contents());
+ g_signal_connect(view->native_view(), "leave-notify-event",
+ G_CALLBACK(OnLeaveNotify2), tab_contents());
+ g_signal_connect(view->native_view(), "motion-notify-event",
+ G_CALLBACK(CallMouseMove), this);
+ g_signal_connect(view->native_view(), "scroll-event",
+ G_CALLBACK(OnMouseScroll), tab_contents());
+ gtk_widget_add_events(view->native_view(), GDK_LEAVE_NOTIFY_MASK |
+ GDK_POINTER_MOTION_MASK);
+
+ // Renderer target DnD.
+ if (tab_contents()->ShouldAcceptDragAndDrop())
+ drag_dest_.reset(new WebDragDestGtk(tab_contents(), view->native_view()));
+
+ return view;
+#else
RenderWidgetHostViewGtk* view =
new RenderWidgetHostViewGtk(render_widget_host);
view->InitAsChild();
@@ -194,6 +222,7 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget(
gtk_fixed_put(GTK_FIXED(GetNativeView()), view->native_view(), 0, 0);
return view;
+#endif
}
gfx::NativeView TabContentsViewGtk::GetNativeView() const {
@@ -391,6 +420,17 @@ gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) {
sad_tab_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height()));
gfx::CanvasSkiaPaint canvas(event);
sad_tab_->ProcessPaint(&canvas);
+ } else {
+#if defined(TOUCH_UI)
+ // there's no native view, so just like sad tabs
+ // we need to pass on the message to paint the page
+ gfx::Rect bounds;
+ GetBounds(&bounds, true);
+ views::View *view = reinterpret_cast<RenderWidgetHostViewViews *>(tab_contents()->render_view_host()->view());
+ view->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height()));
+ gfx::CanvasSkiaPaint canvas(event);
+ view->ProcessPaint(&canvas);
+#endif
}
return false; // False indicates other widgets should get the event as well.
}