summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 20:30:11 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 20:30:11 +0000
commit2a4e56176f21ed9c2a8d53f6fa2b77f8cd789d59 (patch)
tree1d4f7eab471c88492b1612144cf2dca46e8a6ed4 /views
parent963b13d90a9113c2f6f15043e373ffec9fe713c8 (diff)
downloadchromium_src-2a4e56176f21ed9c2a8d53f6fa2b77f8cd789d59.zip
chromium_src-2a4e56176f21ed9c2a8d53f6fa2b77f8cd789d59.tar.gz
chromium_src-2a4e56176f21ed9c2a8d53f6fa2b77f8cd789d59.tar.bz2
Redo of Issue http://codereview.chromium.org/8621006/
Removed most obvious TOUCH_UI tests. Either obvious because we have USE_AURA | TOUCH_UI or because it is in a GTK module. This CL focuses mainly on Views cleanup. BUG=105046 TEST=none Review URL: http://codereview.chromium.org/8632016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_config_aura.cc5
-rw-r--r--views/controls/menu/menu_config_linux.cc5
-rw-r--r--views/controls/menu/menu_controller.h2
-rw-r--r--views/controls/menu/menu_host.cc3
-rw-r--r--views/controls/menu/menu_item_view.cc8
-rw-r--r--views/controls/menu/nested_dispatcher_gtk.cc11
-rw-r--r--views/controls/menu/nested_dispatcher_gtk.h8
-rw-r--r--views/controls/native_control_gtk.cc150
-rw-r--r--views/controls/native_control_gtk.h10
-rw-r--r--views/controls/textfield/native_textfield_views_unittest.cc2
-rw-r--r--views/mouse_watcher.cc2
-rw-r--r--views/views.gyp5
12 files changed, 2 insertions, 209 deletions
diff --git a/views/controls/menu/menu_config_aura.cc b/views/controls/menu/menu_config_aura.cc
index d0aca45..298f924 100644
--- a/views/controls/menu/menu_config_aura.cc
+++ b/views/controls/menu/menu_config_aura.cc
@@ -14,12 +14,7 @@ namespace views {
MenuConfig* MenuConfig::Create() {
MenuConfig* config = new MenuConfig();
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-#if defined(TOUCH_UI)
- config->font = rb.GetFont(ResourceBundle::LargeFont);
- config->show_accelerators = false;
-#else
config->font = rb.GetFont(ResourceBundle::BaseFont);
-#endif
config->arrow_width = rb.GetBitmapNamed(IDR_MENU_ARROW)->width();
// Add 4 to force some padding between check and label.
config->check_width = rb.GetBitmapNamed(IDR_MENU_CHECK)->width() + 4;
diff --git a/views/controls/menu/menu_config_linux.cc b/views/controls/menu/menu_config_linux.cc
index d0aca45..298f924 100644
--- a/views/controls/menu/menu_config_linux.cc
+++ b/views/controls/menu/menu_config_linux.cc
@@ -14,12 +14,7 @@ namespace views {
MenuConfig* MenuConfig::Create() {
MenuConfig* config = new MenuConfig();
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-#if defined(TOUCH_UI)
- config->font = rb.GetFont(ResourceBundle::LargeFont);
- config->show_accelerators = false;
-#else
config->font = rb.GetFont(ResourceBundle::BaseFont);
-#endif
config->arrow_width = rb.GetBitmapNamed(IDR_MENU_ARROW)->width();
// Add 4 to force some padding between check and label.
config->check_width = rb.GetBitmapNamed(IDR_MENU_CHECK)->width() + 4;
diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h
index e85cfdd..b3023f1 100644
--- a/views/controls/menu/menu_controller.h
+++ b/views/controls/menu/menu_controller.h
@@ -223,7 +223,7 @@ class VIEWS_EXPORT MenuController : public MessageLoop::Dispatcher {
#elif defined(USE_WAYLAND)
virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(
base::wayland::WaylandEvent* event);
-#elif defined(TOUCH_UI) || defined(USE_AURA)
+#elif defined(USE_AURA)
virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xevent);
#else
virtual bool Dispatch(GdkEvent* event);
diff --git a/views/controls/menu/menu_host.cc b/views/controls/menu/menu_host.cc
index 075fa82..740cc81 100644
--- a/views/controls/menu/menu_host.cc
+++ b/views/controls/menu/menu_host.cc
@@ -48,9 +48,6 @@ void MenuHost::ShowMenuHost(bool do_capture) {
// process of showing.
ignore_capture_lost_ = true;
Show();
-#if defined(TOUCH_UI)
- Activate();
-#endif
if (do_capture)
native_widget_private()->SetMouseCapture();
ignore_capture_lost_ = false;
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 9d0d119..c361648 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -54,10 +54,6 @@ class EmptyMenuMenuItem : public MenuItemView {
// Padding between child views.
static const int kChildXPadding = 8;
-#if defined(TOUCH_UI)
-const int kMinItemHeightTouch = 40;
-#endif
-
// MenuItemView ---------------------------------------------------------------
// static
@@ -750,11 +746,7 @@ gfx::Size MenuItemView::CalculatePreferredSize() {
}
const gfx::Font& font = GetFont();
-#if defined(TOUCH_UI)
- int height = std::max(font.GetHeight(), kMinItemHeightTouch);
-#else
int height = font.GetHeight();
-#endif
return gfx::Size(
font.GetStringWidth(title_) + label_start_ +
item_right_margin_ + child_size.width(),
diff --git a/views/controls/menu/nested_dispatcher_gtk.cc b/views/controls/menu/nested_dispatcher_gtk.cc
index 6504acc..cb3d189 100644
--- a/views/controls/menu/nested_dispatcher_gtk.cc
+++ b/views/controls/menu/nested_dispatcher_gtk.cc
@@ -4,10 +4,6 @@
#include "views/controls/menu/nested_dispatcher_gtk.h"
-#if defined(TOUCH_UI)
-#include "ui/views/focus/accelerator_handler.h"
-#endif
-
namespace views {
NestedDispatcherGtk::NestedDispatcherGtk(MessageLoopForUI::Dispatcher* creator,
@@ -32,15 +28,8 @@ void NestedDispatcherGtk::CreatorDestroyed() {
creator_ = NULL;
}
-#if defined(TOUCH_UI)
-base::MessagePumpDispatcher::DispatchStatus
- NestedDispatcherGtk::Dispatch(XEvent* xevent) {
- return creator_->Dispatch(xevent);
-}
-#else
bool NestedDispatcherGtk::Dispatch(GdkEvent* event) {
return creator_ && creator_->Dispatch(event);
}
-#endif // defined(TOUCH_UI)
} // namespace views
diff --git a/views/controls/menu/nested_dispatcher_gtk.h b/views/controls/menu/nested_dispatcher_gtk.h
index 0520b4d..eaad46e 100644
--- a/views/controls/menu/nested_dispatcher_gtk.h
+++ b/views/controls/menu/nested_dispatcher_gtk.h
@@ -8,10 +8,6 @@
#include "base/message_loop.h"
-#if defined(TOUCH_UI)
-typedef union _XEvent XEvent;
-#endif
-
namespace views {
// A nested dispatcher that can out-live the creator of this
@@ -37,12 +33,8 @@ class NestedDispatcherGtk : public MessageLoopForUI::Dispatcher {
private:
virtual ~NestedDispatcherGtk() {}
-#if defined(TOUCH_UI)
- virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xevent);
-#else
// Overriden from MessageLoopForUI::Dispatcher:
virtual bool Dispatch(GdkEvent* event);
-#endif
// Creator of the nested loop.
MessageLoopForUI::Dispatcher* creator_;
diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc
index 52b2d45..24410f4 100644
--- a/views/controls/native_control_gtk.cc
+++ b/views/controls/native_control_gtk.cc
@@ -11,135 +11,8 @@
#include "ui/views/focus/focus_manager.h"
#include "ui/views/widget/widget.h"
-#if defined(TOUCH_UI)
-namespace {
-
-GdkEvent* MouseButtonEvent(const views::MouseEvent& mouseev,
- const views::NativeViewHost* source) {
- GdkEvent* event = NULL;
- switch (mouseev.type()) {
- case ui::ET_MOUSE_PRESSED:
- event = gdk_event_new(GDK_BUTTON_PRESS);
- break;
- case ui::ET_MOUSE_RELEASED:
- event = gdk_event_new(GDK_BUTTON_RELEASE);
- break;
- default:
- NOTREACHED();
- return NULL;
- }
- event->button.send_event = false;
- event->button.time = GDK_CURRENT_TIME;
-
- // Ideally using native_view()->window should work, but it doesn't.
- event->button.window = gdk_window_at_pointer(NULL, NULL);
- g_object_ref(event->button.window);
- event->button.x = mouseev.location().x();
- event->button.y = mouseev.location().y();
-
- gfx::Point point = mouseev.location();
- views::View::ConvertPointToScreen(source, &point);
- event->button.x_root = point.x();
- event->button.y_root = point.y();
-
- event->button.axes = NULL;
-
- // Ideally, this should reconstruct the state from mouseev.flags().
- GdkModifierType modifier;
- gdk_window_get_pointer(event->button.window, NULL, NULL, &modifier);
- event->button.state = modifier;
-
- event->button.button = (mouseev.flags() & ui::EF_LEFT_BUTTON_DOWN) ? 1 :
- (mouseev.flags() & ui::EF_RIGHT_BUTTON_DOWN) ? 3 :
- 2;
- event->button.device = gdk_device_get_core_pointer();
- return event;
-}
-
-GdkEvent* MouseMoveEvent(const views::MouseEvent& mouseev,
- const views::NativeViewHost* source) {
- GdkEvent* event = gdk_event_new(GDK_MOTION_NOTIFY);
- event->motion.send_event = false;
- event->motion.time = GDK_CURRENT_TIME;
-
- event->motion.window = source->native_view()->window;
- g_object_ref(event->motion.window);
- event->motion.x = mouseev.location().x();
- event->motion.y = mouseev.location().y();
-
- gfx::Point point = mouseev.location();
- views::View::ConvertPointToScreen(source, &point);
- event->motion.x_root = point.x();
- event->motion.y_root = point.y();
-
- event->motion.device = gdk_device_get_core_pointer();
- return event;
-}
-
-GdkEvent* MouseCrossEvent(const views::MouseEvent& mouseev,
- const views::NativeViewHost* source) {
- GdkEvent* event = NULL;
- switch (mouseev.type()) {
- case ui::ET_MOUSE_ENTERED:
- event = gdk_event_new(GDK_ENTER_NOTIFY);
- break;
- case ui::ET_MOUSE_EXITED:
- event = gdk_event_new(GDK_LEAVE_NOTIFY);
- break;
- default:
- NOTREACHED();
- return NULL;
- }
- event->crossing.send_event = false;
- event->crossing.time = GDK_CURRENT_TIME;
-
- event->crossing.window = source->native_view()->window;
- g_object_ref(event->crossing.window);
-
- event->crossing.x = event->crossing.y = 0;
- event->crossing.x_root = event->crossing.y_root = 0;
- event->crossing.mode = GDK_CROSSING_NORMAL;
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- event->crossing.focus = false;
- event->crossing.state = 0;
-
- return event;
-}
-
-} // namespace
-#endif // defined(TOUCH_UI)
-
namespace views {
-#if defined(TOUCH_UI)
-void NativeControlGtk::FakeNativeMouseEvent(const MouseEvent& mouseev) {
- GdkEvent* event = NULL;
- switch (mouseev.type()) {
- case ui::ET_MOUSE_PRESSED:
- case ui::ET_MOUSE_RELEASED:
- event = MouseButtonEvent(mouseev, this);
- break;
- case ui::ET_MOUSE_MOVED:
- event = MouseMoveEvent(mouseev, this);
- break;
- case ui::ET_MOUSE_ENTERED:
- case ui::ET_MOUSE_EXITED:
- event = MouseCrossEvent(mouseev, this);
- break;
- default:
- NOTREACHED();
- return;
- }
-
- if (event) {
- // Do not gdk_event_put, since that will end up going through the
- // message-loop and turn into an infinite loop.
- gtk_widget_event(native_view(), event);
- gdk_event_free(event);
- }
-}
-#endif // defined(TOUCH_UI)
-
NativeControlGtk::NativeControlGtk() {
}
@@ -189,29 +62,6 @@ void NativeControlGtk::OnFocus() {
parent(), ui::AccessibilityTypes::EVENT_FOCUS, true);
}
-#if defined(TOUCH_UI)
-bool NativeControlGtk::OnMousePressed(const MouseEvent& mouseev) {
- FakeNativeMouseEvent(mouseev);
- return true;
-}
-
-void NativeControlGtk::OnMouseReleased(const MouseEvent& mouseev) {
- FakeNativeMouseEvent(mouseev);
-}
-
-void NativeControlGtk::OnMouseMoved(const MouseEvent& mouseev) {
- FakeNativeMouseEvent(mouseev);
-}
-
-void NativeControlGtk::OnMouseEntered(const MouseEvent& mouseev) {
- FakeNativeMouseEvent(mouseev);
-}
-
-void NativeControlGtk::OnMouseExited(const MouseEvent& mouseev) {
- FakeNativeMouseEvent(mouseev);
-}
-#endif // defined(TOUCH_UI)
-
void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) {
Attach(native_control);
diff --git a/views/controls/native_control_gtk.h b/views/controls/native_control_gtk.h
index 0333e36..89e1cb0 100644
--- a/views/controls/native_control_gtk.h
+++ b/views/controls/native_control_gtk.h
@@ -25,16 +25,6 @@ class NativeControlGtk : public NativeViewHost {
virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child);
virtual void VisibilityChanged(View* starting_from, bool is_visible);
virtual void OnFocus();
-#if defined(TOUCH_UI)
- virtual bool OnMousePressed(const MouseEvent& event);
- virtual void OnMouseReleased(const MouseEvent& event);
- virtual void OnMouseMoved(const MouseEvent& event);
- virtual void OnMouseExited(const MouseEvent& event);
- virtual void OnMouseEntered(const MouseEvent& event);
-
- // Fake a mouse event.
- void FakeNativeMouseEvent(const MouseEvent& event);
-#endif
// Called when the NativeControlGtk is attached to a View hierarchy with a
// valid Widget. The NativeControlGtk should use this opportunity to create
diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc
index 9033f81..7e8b3ef 100644
--- a/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/views/controls/textfield/native_textfield_views_unittest.cc
@@ -797,7 +797,6 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) {
}
#endif
-#if !defined(TOUCH_UI)
TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_InitiateDrag) {
InitTextfield(Textfield::STYLE_DEFAULT);
textfield_->SetText(ASCIIToUTF16("hello string world"));
@@ -969,7 +968,6 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_Canceled) {
textfield_view_->OnDragDone();
EXPECT_EQ(ASCIIToUTF16("hello world"), textfield_->text());
}
-#endif
TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) {
InitTextfield(Textfield::STYLE_DEFAULT);
diff --git a/views/mouse_watcher.cc b/views/mouse_watcher.cc
index 3b2b039..d074860 100644
--- a/views/mouse_watcher.cc
+++ b/views/mouse_watcher.cc
@@ -77,7 +77,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
}
return EVENT_CONTINUE;
}
-#elif defined(TOUCH_UI) || defined(USE_AURA)
+#elif defined(USE_AURA)
virtual base::EventStatus WillProcessEvent(
const base::NativeEvent& event) OVERRIDE {
return base::EVENT_CONTINUE;
diff --git a/views/views.gyp b/views/views.gyp
index 02b90bd..2759c4d 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -13,11 +13,6 @@
['include', '/win/'],
['include', '/win_[^/]*\\.cc$'],
]}],
- ['touchui==0', {
- 'sources/': [
- ['exclude', '_(touch)\\.cc$'],
- ],
- }],
['use_aura==1', {
'sources/': [ ['exclude', '_win\\.(h|cc)$'],
['exclude', '_gtk\\.(h|cc)$'],