These are the changes necessary for views to be able to build w/ use_aura implying no gtk.

BUG=97131
TEST=views_unittests

Review URL: http://codereview.chromium.org/7996008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102335 0039d316-1c4b-4281-b951-d872f2087c98
parent 5b5e1e2f
...@@ -43,12 +43,6 @@ ...@@ -43,12 +43,6 @@
#error Please add support for your platform in build/build_config.h #error Please add support for your platform in build/build_config.h
#endif #endif
// A flag derived from the above flags, used to cover GTK code in
// both TOOLKIT_GTK and TOOLKIT_VIEWS.
#if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN))
#define TOOLKIT_USES_GTK 1
#endif
#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \ #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
defined(OS_SOLARIS) || defined(OS_ANDROID) defined(OS_SOLARIS) || defined(OS_ANDROID)
#if !defined(USE_OPENSSL) #if !defined(USE_OPENSSL)
......
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
'use_x11%': 1, 'use_x11%': 1,
}], }],
['use_aura==1 and OS!="win"', { ['use_aura==1 and OS!="win"', {
'toolkit_uses_gtk%': 1, 'toolkit_uses_gtk%': 0,
}], }],
# A flag to enable or disable our compile-time dependency # A flag to enable or disable our compile-time dependency
...@@ -856,6 +856,9 @@ ...@@ -856,6 +856,9 @@
['use_aura==1', { ['use_aura==1', {
'defines': ['USE_AURA=1'], 'defines': ['USE_AURA=1'],
}], }],
['toolkit_uses_gtk==1', {
'defines': ['TOOLKIT_USES_GTK=1'],
}],
['chromeos==1', { ['chromeos==1', {
'defines': ['OS_CHROMEOS=1'], 'defines': ['OS_CHROMEOS=1'],
}], }],
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#if defined(OS_WIN) #if defined(OS_WIN)
#include <windows.h> #include <windows.h>
#elif defined(OS_LINUX) #elif defined(TOOLKIT_USES_GTK)
#include <gdk/gdk.h> #include <gdk/gdk.h>
#endif #endif
...@@ -83,7 +83,7 @@ string16 Accelerator::GetShortcutText() const { ...@@ -83,7 +83,7 @@ string16 Accelerator::GetShortcutText() const {
else else
key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR));
shortcut += key; shortcut += key;
#elif defined(OS_LINUX) #elif defined(TOOLKIT_USES_GTK)
const gchar* name = NULL; const gchar* name = NULL;
switch (key_code_) { switch (key_code_) {
case ui::VKEY_OEM_2: case ui::VKEY_OEM_2:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include <gdk/gdk.h> #include <gdk/gdk.h>
#endif #endif
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "views/controls/link_listener.h" #include "views/controls/link_listener.h"
#include "views/events/event.h" #include "views/events/event.h"
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include "ui/gfx/gtk_util.h" #include "ui/gfx/gtk_util.h"
#endif #endif
...@@ -103,11 +103,11 @@ gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { ...@@ -103,11 +103,11 @@ gfx::NativeCursor Link::GetCursor(const MouseEvent& event) {
#if defined(OS_WIN) #if defined(OS_WIN)
static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND);
return g_hand_cursor; return g_hand_cursor;
#elif defined(USE_AURA) #elif defined(TOOLKIT_USES_GTK)
return gfx::GetCursor(GDK_HAND2);
#else
// TODO(saintlou): // TODO(saintlou):
return NULL; return NULL;
#elif defined(OS_LINUX)
return gfx::GetCursor(GDK_HAND2);
#endif #endif
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "views/controls/single_split_view.h" #include "views/controls/single_split_view.h"
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include <gdk/gdk.h> #include <gdk/gdk.h>
#endif #endif
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "views/background.h" #include "views/background.h"
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include "ui/gfx/gtk_util.h" #include "ui/gfx/gtk_util.h"
#endif #endif
...@@ -100,12 +100,12 @@ gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) { ...@@ -100,12 +100,12 @@ gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) {
static HCURSOR we_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); static HCURSOR we_resize_cursor = LoadCursor(NULL, IDC_SIZEWE);
static HCURSOR ns_resize_cursor = LoadCursor(NULL, IDC_SIZENS); static HCURSOR ns_resize_cursor = LoadCursor(NULL, IDC_SIZENS);
return is_horizontal_ ? we_resize_cursor : ns_resize_cursor; return is_horizontal_ ? we_resize_cursor : ns_resize_cursor;
#elif defined(USE_AURA) #elif defined(TOOLKIT_USES_GTK)
// TODO(saintlou):
return NULL;
#elif defined(OS_LINUX)
return gfx::GetCursor(is_horizontal_ ? GDK_SB_H_DOUBLE_ARROW : return gfx::GetCursor(is_horizontal_ ? GDK_SB_H_DOUBLE_ARROW :
GDK_SB_V_DOUBLE_ARROW); GDK_SB_V_DOUBLE_ARROW);
#else
// TODO(saintlou):
return NULL;
#endif #endif
} }
......
...@@ -715,6 +715,7 @@ TEST_F(NativeTextfieldViewsTest, DragToSelect) { ...@@ -715,6 +715,7 @@ TEST_F(NativeTextfieldViewsTest, DragToSelect) {
EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText());
} }
#if defined(OS_WIN) || defined(TOOLKIT_USES_GTK)
TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) {
InitTextfield(Textfield::STYLE_DEFAULT); InitTextfield(Textfield::STYLE_DEFAULT);
textfield_->SetText(ASCIIToUTF16("hello world")); textfield_->SetText(ASCIIToUTF16("hello world"));
...@@ -769,6 +770,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { ...@@ -769,6 +770,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) {
#endif #endif
EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); EXPECT_FALSE(textfield_view_->CanDrop(bad_data));
} }
#endif
#if !defined(TOUCH_UI) #if !defined(TOUCH_UI)
TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "views/controls/textfield/textfield.h" #include "views/controls/textfield/textfield.h"
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#endif #endif
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_LINUX)
#include <gdk/gdk.h>
#endif
#include <string> #include <string>
#include "base/basictypes.h" #include "base/basictypes.h"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include <gdk/gdk.h> #include <gdk/gdk.h>
#endif #endif
......
...@@ -35,10 +35,10 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { ...@@ -35,10 +35,10 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
// MessageLoop::Observer implementation: // MessageLoop::Observer implementation:
#if defined(OS_WIN) #if defined(OS_WIN)
void WillProcessMessage(const MSG& msg) { void WillProcessMessage(const MSG& msg) OVERRIDE {
} }
void DidProcessMessage(const MSG& msg) { void DidProcessMessage(const MSG& msg) OVERRIDE {
// We spy on three different Windows messages here to see if the mouse has // We spy on three different Windows messages here to see if the mouse has
// moved out of the bounds of the view. The messages are: // moved out of the bounds of the view. The messages are:
// //
...@@ -62,7 +62,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { ...@@ -62,7 +62,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
} }
#elif defined(USE_WAYLAND) #elif defined(USE_WAYLAND)
MessageLoopForUI::Observer::EventStatus WillProcessEvent( MessageLoopForUI::Observer::EventStatus WillProcessEvent(
ui::WaylandEvent* event) { ui::WaylandEvent* event) OVERRIDE {
switch (event->type) { switch (event->type) {
case ui::WAYLAND_MOTION: case ui::WAYLAND_MOTION:
HandleGlobalMouseMoveEvent(false); HandleGlobalMouseMoveEvent(false);
...@@ -76,11 +76,11 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { ...@@ -76,11 +76,11 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
} }
#else #elif defined(TOOLKIT_USES_GTK)
void WillProcessEvent(GdkEvent* event) { void WillProcessEvent(GdkEvent* event) OVERRIDE {
} }
void DidProcessEvent(GdkEvent* event) { void DidProcessEvent(GdkEvent* event) OVERRIDE {
switch (event->type) { switch (event->type) {
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
HandleGlobalMouseMoveEvent(false); HandleGlobalMouseMoveEvent(false);
...@@ -92,6 +92,11 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { ...@@ -92,6 +92,11 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
break; break;
} }
} }
#else
EventStatus WillProcessXEvent(XEvent* event) OVERRIDE {
// TODO(davemoore) Implement.
return EVENT_CONTINUE;
}
#endif #endif
private: private:
......
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
#include "views/touchui/touch_factory.h" #include "views/touchui/touch_factory.h"
#if defined(TOOLKIT_USES_GTK)
// TODO(sad) Remove all TOOLKIT_USES_GTK uses once we move to aura only.
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include <X11/extensions/XInput.h> #include <X11/extensions/XInput.h>
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
...@@ -71,6 +74,7 @@ XIValuatorClassInfo* FindTPValuator(Display* display, ...@@ -71,6 +74,7 @@ XIValuatorClassInfo* FindTPValuator(Display* display,
return NULL; return NULL;
} }
#if defined(TOOLKIT_USES_GTK)
// Setup XInput2 select for the GtkWidget. // Setup XInput2 select for the GtkWidget.
gboolean GtkWidgetRealizeCallback(GSignalInvocationHint* hint, guint nparams, gboolean GtkWidgetRealizeCallback(GSignalInvocationHint* hint, guint nparams,
const GValue* pvalues, gpointer data) { const GValue* pvalues, gpointer data) {
...@@ -112,6 +116,7 @@ void RemoveGtkWidgetRealizeNotifier() { ...@@ -112,6 +116,7 @@ void RemoveGtkWidgetRealizeNotifier() {
realize_signal_id = 0; realize_signal_id = 0;
realize_hook_id = 0; realize_hook_id = 0;
} }
#endif
} // namespace } // namespace
...@@ -147,11 +152,12 @@ TouchFactory::TouchFactory() ...@@ -147,11 +152,12 @@ TouchFactory::TouchFactory()
SetCursorVisible(false, false); SetCursorVisible(false, false);
UpdateDeviceList(display); UpdateDeviceList(display);
#if defined(TOOLKIT_USES_GTK)
// TODO(sad): Here, we only setup so that the X windows created by GTK+ are // TODO(sad): Here, we only setup so that the X windows created by GTK+ are
// setup for XInput2 events. We need a way to listen for XInput2 events for X // setup for XInput2 events. We need a way to listen for XInput2 events for X
// windows created by other means (e.g. for context menus). // windows created by other means (e.g. for context menus).
SetupGtkWidgetRealizeNotifier(this); SetupGtkWidgetRealizeNotifier(this);
#endif
// Make sure the list of devices is kept up-to-date by listening for // Make sure the list of devices is kept up-to-date by listening for
// XI_HierarchyChanged event on the root window. // XI_HierarchyChanged event on the root window.
unsigned char mask[XIMaskLen(XI_LASTEVENT)]; unsigned char mask[XIMaskLen(XI_LASTEVENT)];
...@@ -177,7 +183,9 @@ TouchFactory::~TouchFactory() { ...@@ -177,7 +183,9 @@ TouchFactory::~TouchFactory() {
XFreeCursor(display, invisible_cursor_); XFreeCursor(display, invisible_cursor_);
XFreeCursor(display, arrow_cursor_); XFreeCursor(display, arrow_cursor_);
#if defined(TOOLKIT_USES_GTK)
RemoveGtkWidgetRealizeNotifier(); RemoveGtkWidgetRealizeNotifier();
#endif
} }
void TouchFactory::UpdateDeviceList(Display* display) { void TouchFactory::UpdateDeviceList(Display* display) {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "base/win/scoped_gdi_object.h" #include "base/win/scoped_gdi_object.h"
#include "views/accessibility/native_view_accessibility_win.h" #include "views/accessibility/native_view_accessibility_win.h"
#endif #endif
#if defined(OS_LINUX) #if defined(TOOLKIT_USES_GTK)
#include "ui/base/gtk/scoped_handle_gtk.h" #include "ui/base/gtk/scoped_handle_gtk.h"
#endif #endif
......
...@@ -481,7 +481,7 @@ TEST_F(ViewTest, DISABLED_Painting) { ...@@ -481,7 +481,7 @@ TEST_F(ViewTest, DISABLED_Painting) {
#if defined(OS_WIN) #if defined(OS_WIN)
TEST_F(ViewTest, RemoveNotification) { TEST_F(ViewTest, RemoveNotification) {
#elif defined(TOOLKIT_USES_GTK) #else
// TODO(beng): stopped working with widget hierarchy split, // TODO(beng): stopped working with widget hierarchy split,
// http://crbug.com/82364 // http://crbug.com/82364
TEST_F(ViewTest, DISABLED_RemoveNotification) { TEST_F(ViewTest, DISABLED_RemoveNotification) {
......
...@@ -550,12 +550,14 @@ ...@@ -550,12 +550,14 @@
'../base/base.gyp:base', '../base/base.gyp:base',
'../base/base.gyp:test_support_base', '../base/base.gyp:test_support_base',
'../build/temp_gyp/googleurl.gyp:googleurl', '../build/temp_gyp/googleurl.gyp:googleurl',
'../chrome/chrome.gyp:packed_resources',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock', '../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icui18n',
'../third_party/icu/icu.gyp:icuuc', '../third_party/icu/icu.gyp:icuuc',
'../ui/base/strings/ui_strings.gyp:ui_strings', '../ui/base/strings/ui_strings.gyp:ui_strings',
'../ui/gfx/compositor/compositor.gyp:compositor',
'../ui/ui.gyp:gfx_resources', '../ui/ui.gyp:gfx_resources',
'../ui/ui.gyp:ui', '../ui/ui.gyp:ui',
'../ui/ui.gyp:ui_resources', '../ui/ui.gyp:ui_resources',
......
...@@ -157,12 +157,12 @@ bool WidgetHasMouseCapture(const Widget* widget) { ...@@ -157,12 +157,12 @@ bool WidgetHasMouseCapture(const Widget* widget) {
TEST_F(WidgetTest, GetTopLevelWidget_Native) { TEST_F(WidgetTest, GetTopLevelWidget_Native) {
// Create a hierarchy of native widgets. // Create a hierarchy of native widgets.
Widget* toplevel = CreateTopLevelPlatformWidget(); Widget* toplevel = CreateTopLevelPlatformWidget();
#if defined(OS_WIN) #if defined(TOOLKIT_USES_GTK)
gfx::NativeView parent = toplevel->GetNativeView();
#elif defined(TOOLKIT_USES_GTK)
NativeWidgetGtk* native_widget = NativeWidgetGtk* native_widget =
static_cast<NativeWidgetGtk*>(toplevel->native_widget()); static_cast<NativeWidgetGtk*>(toplevel->native_widget());
gfx::NativeView parent = native_widget->window_contents(); gfx::NativeView parent = native_widget->window_contents();
#else
gfx::NativeView parent = toplevel->GetNativeView();
#endif #endif
Widget* child = CreateChildPlatformWidget(parent); Widget* child = CreateChildPlatformWidget(parent);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <windows.h> #include <windows.h>
#include <uxtheme.h> #include <uxtheme.h>
#include <vsstyle.h> #include <vsstyle.h>
#else #elif defined(TOOLKIT_USES_GTK)
#include <gtk/gtk.h> #include <gtk/gtk.h>
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment