diff options
author | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 00:54:15 +0000 |
---|---|---|
committer | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 00:54:15 +0000 |
commit | 6c9280ab81b854289f65fe4580aa756d86aec9fd (patch) | |
tree | 8ddc4e65570084db681f7898d91d477e2bd75e44 | |
parent | d5db7b226c885ff5541cb8a3ae7b37494897d33b (diff) | |
download | chromium_src-6c9280ab81b854289f65fe4580aa756d86aec9fd.zip chromium_src-6c9280ab81b854289f65fe4580aa756d86aec9fd.tar.gz chromium_src-6c9280ab81b854289f65fe4580aa756d86aec9fd.tar.bz2 |
Removing GTK code from ui/views.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9804001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127852 0039d316-1c4b-4281-b951-d872f2087c98
25 files changed, 5 insertions, 291 deletions
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc index 6339317..1f0b2b0 100644 --- a/ui/views/controls/button/text_button.cc +++ b/ui/views/controls/button/text_button.cc @@ -692,8 +692,6 @@ gfx::Size TextButton::GetPreferredSize() { prefsize.height(), platform_font->vertical_dlus_to_pixels(kMinHeightDLUs))); } - // GTK returns a meaningful preferred size so that we don't need to adjust - // the preferred size as we do on windows. #endif return prefsize; diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc index 1ca4b87..49a9d838 100644 --- a/ui/views/controls/link.cc +++ b/ui/views/controls/link.cc @@ -6,10 +6,6 @@ #include "build/build_config.h" -#if defined(TOOLKIT_USES_GTK) -#include <gdk/gdk.h> -#endif - #include "base/logging.h" #include "base/utf_string_conversions.h" #include "ui/base/accessibility/accessible_view_state.h" @@ -19,10 +15,6 @@ #include "ui/views/controls/link_listener.h" #include "ui/views/events/event.h" -#if defined(TOOLKIT_USES_GTK) -#include "ui/gfx/gtk_util.h" -#endif - #if defined(USE_AURA) #include "ui/aura/cursor.h" #endif @@ -59,8 +51,6 @@ gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { #elif defined(OS_WIN) static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); return g_hand_cursor; -#elif defined(TOOLKIT_USES_GTK) - return gfx::GetCursor(GDK_HAND2); #endif } diff --git a/ui/views/controls/menu/menu_2.h b/ui/views/controls/menu/menu_2.h index 0b6fcae..87d1ca0 100644 --- a/ui/views/controls/menu/menu_2.h +++ b/ui/views/controls/menu/menu_2.h @@ -22,8 +22,6 @@ class MenuModel; namespace views { -class NativeMenuGtk; - // A menu. Populated from a model, and relies on a delegate to execute commands. // // WARNING: do NOT create and use Menu2 on the stack. Menu2 notifies the model @@ -85,7 +83,6 @@ class VIEWS_EXPORT Menu2 { void SetMinimumWidth(int width); private: - friend class NativeMenuGtk; ui::MenuModel* model_; diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 8a64110..115a650 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -28,8 +28,6 @@ #include "ui/aura/client/dispatcher_client.h" #include "ui/aura/env.h" #include "ui/aura/root_window.h" -#elif defined(TOOLKIT_USES_GTK) -#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" #endif using base::Time; @@ -953,37 +951,6 @@ base::MessagePumpDispatcher::DispatchStatus base::MessagePumpDispatcher::EVENT_QUIT : base::MessagePumpDispatcher::EVENT_PROCESSED; } -#else -bool MenuController::Dispatch(GdkEvent* event) { - if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) { - gtk_main_do_event(event); - return false; - } - - switch (event->type) { - case GDK_KEY_PRESS: { - if (!OnKeyDown(ui::WindowsKeyCodeForGdkKeyCode(event->key.keyval))) - return false; - - guint32 keycode = gdk_keyval_to_unicode(event->key.keyval); - if (keycode) - return !SelectByChar(keycode); - return true; - } - - case GDK_KEY_RELEASE: - return true; - - default: - break; - } - - // We don't want Gtk to handle keyboard events, otherwise if they get - // handled by Gtk, unexpected behavior may occur. For example Tab key - // may cause unexpected focus traversing. - gtk_main_do_event(event); - return exit_type_ == EXIT_NONE; -} #endif bool MenuController::OnKeyDown(ui::KeyboardCode key_code) { diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h index a043d15..9588186 100644 --- a/ui/views/controls/menu/menu_controller.h +++ b/ui/views/controls/menu/menu_controller.h @@ -248,8 +248,6 @@ class VIEWS_EXPORT MenuController : public MessageLoop::Dispatcher { #elif defined(USE_AURA) virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( XEvent* xevent) OVERRIDE; -#else - virtual bool Dispatch(GdkEvent* event) OVERRIDE; #endif // Key processing. The return value of this is returned from Dispatch. diff --git a/ui/views/controls/resize_area.cc b/ui/views/controls/resize_area.cc index 207d3b4..c19361c 100644 --- a/ui/views/controls/resize_area.cc +++ b/ui/views/controls/resize_area.cc @@ -9,10 +9,6 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/views/controls/resize_area_delegate.h" -#if defined(OS_LINUX) -#include "ui/gfx/gtk_util.h" -#endif - #if defined(USE_AURA) #include "ui/aura/cursor.h" #endif @@ -44,8 +40,6 @@ gfx::NativeCursor ResizeArea::GetCursor(const MouseEvent& event) { #elif defined(OS_WIN) static HCURSOR g_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); return g_resize_cursor; -#elif defined(OS_LINUX) - return gfx::GetCursor(GDK_SB_H_DOUBLE_ARROW); #endif } diff --git a/ui/views/controls/single_split_view.cc b/ui/views/controls/single_split_view.cc index 75ea284..3b4453d 100644 --- a/ui/views/controls/single_split_view.cc +++ b/ui/views/controls/single_split_view.cc @@ -4,20 +4,12 @@ #include "ui/views/controls/single_split_view.h" -#if defined(TOOLKIT_USES_GTK) -#include <gdk/gdk.h> -#endif - #include "skia/ext/skia_utils_win.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "ui/views/background.h" #include "ui/views/controls/single_split_view_listener.h" -#if defined(TOOLKIT_USES_GTK) -#include "ui/gfx/gtk_util.h" -#endif - #if defined(USE_AURA) #include "ui/aura/cursor.h" #endif @@ -108,9 +100,6 @@ gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) { static HCURSOR we_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); static HCURSOR ns_resize_cursor = LoadCursor(NULL, IDC_SIZENS); return is_horizontal_ ? we_resize_cursor : ns_resize_cursor; -#elif defined(TOOLKIT_USES_GTK) - return gfx::GetCursor(is_horizontal_ ? GDK_SB_H_DOUBLE_ARROW : - GDK_SB_V_DOUBLE_ARROW); #endif } diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index f82fba1..bb74127 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -37,10 +37,6 @@ #include "ui/views/views_delegate.h" #include "ui/views/widget/widget.h" -#if defined(OS_LINUX) -#include "ui/gfx/gtk_util.h" -#endif - #if defined(USE_AURA) #include "ui/aura/cursor.h" #endif @@ -273,8 +269,6 @@ gfx::NativeCursor NativeTextfieldViews::GetCursor(const MouseEvent& event) { static HCURSOR ibeam = LoadCursor(NULL, IDC_IBEAM); static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); return text_cursor ? ibeam : arrow; -#else - return text_cursor ? gfx::GetCursor(GDK_XTERM) : NULL; #endif } diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc index 37a7e6a..d1884a6 100644 --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc @@ -746,7 +746,7 @@ TEST_F(NativeTextfieldViewsTest, DragToSelect) { EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); } -#if defined(OS_WIN) || defined(TOOLKIT_USES_GTK) +#if defined(OS_WIN) TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { InitTextfield(Textfield::STYLE_DEFAULT); textfield_->SetText(ASCIIToUTF16("hello world")); @@ -794,10 +794,6 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); ui::OSExchangeData::DownloadFileInfo download(FilePath(), NULL); bad_data.SetDownloadFileInfo(download); -#else - // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. - bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); - bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); #endif EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); } diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index 15f8028..d110b58 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc @@ -4,10 +4,6 @@ #include "ui/views/controls/textfield/textfield.h" -#if defined(TOOLKIT_USES_GTK) -#include <gdk/gdkkeysyms.h> -#endif - #include <string> #include "base/string_util.h" @@ -23,9 +19,7 @@ #include "ui/views/controls/textfield/textfield_controller.h" #include "ui/views/widget/widget.h" -#if defined(OS_LINUX) -#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" -#elif defined(OS_WIN) +#if defined(OS_WIN) #include "base/win/win_util.h" // TODO(beng): this should be removed when the OS_WIN hack from // ViewHierarchyChanged is removed. diff --git a/ui/views/events/event.cc b/ui/views/events/event.cc index 66abced..fe2384e 100644 --- a/ui/views/events/event.cc +++ b/ui/views/events/event.cc @@ -20,9 +20,6 @@ Event::Event(ui::EventType type, int flags) flags_(flags) { // Safely initialize the pointer/struct to null/empty. memset(&native_event_, 0, sizeof(native_event_)); -#if defined(TOOLKIT_USES_GTK) - gdk_event_ = NULL; -#endif } Event::Event(const NativeEvent& native_event, ui::EventType type, int flags) @@ -30,9 +27,6 @@ Event::Event(const NativeEvent& native_event, ui::EventType type, int flags) type_(type), time_stamp_(base::Time::NowFromSystemTime()), flags_(flags) { -#if defined(TOOLKIT_USES_GTK) - gdk_event_ = NULL; -#endif } //////////////////////////////////////////////////////////////////////////////// diff --git a/ui/views/events/event.h b/ui/views/events/event.h index ad37b3a..d5b82a0 100644 --- a/ui/views/events/event.h +++ b/ui/views/events/event.h @@ -23,11 +23,6 @@ class Event; } #endif -// TODO(msw): Remove GTK support from views event code when possible. -#if defined(TOOLKIT_USES_GTK) -typedef union _GdkEvent GdkEvent; -#endif - namespace views { #if defined(USE_AURA) @@ -57,9 +52,6 @@ class RootView; class VIEWS_EXPORT Event { public: const NativeEvent& native_event() const { return native_event_; } -#if defined(TOOLKIT_USES_GTK) - GdkEvent* gdk_event() const { return gdk_event_; } -#endif ui::EventType type() const { return type_; } const base::Time& time_stamp() const { return time_stamp_; } @@ -97,15 +89,8 @@ class VIEWS_EXPORT Event { protected: Event(ui::EventType type, int flags); Event(const NativeEvent& native_event, ui::EventType type, int flags); -#if defined(TOOLKIT_USES_GTK) - Event(GdkEvent* gdk_event, ui::EventType type, int flags); -#endif - Event(const Event& model) : native_event_(model.native_event()), -#if defined(TOOLKIT_USES_GTK) - gdk_event_(model.gdk_event_), -#endif type_(model.type()), time_stamp_(model.time_stamp()), flags_(model.flags()) { @@ -117,9 +102,6 @@ class VIEWS_EXPORT Event { void operator=(const Event&); NativeEvent native_event_; -#if defined(TOOLKIT_USES_GTK) - GdkEvent* gdk_event_; -#endif ui::EventType type_; base::Time time_stamp_; int flags_; @@ -141,9 +123,6 @@ class VIEWS_EXPORT LocatedEvent : public Event { protected: explicit LocatedEvent(const NativeEvent& native_event); -#if defined(TOOLKIT_USES_GTK) - explicit LocatedEvent(GdkEvent* gdk_event); -#endif // TODO(msw): Kill this legacy constructor when we update uses. // Simple initialization from cracked metadata. @@ -173,10 +152,6 @@ class TouchEvent; class VIEWS_EXPORT MouseEvent : public LocatedEvent { public: explicit MouseEvent(const NativeEvent& native_event); -#if defined(TOOLKIT_USES_GTK) - explicit MouseEvent(GdkEvent* gdk_event); -#endif - // Create a new MouseEvent which is identical to the provided model. // If source / target views are provided, the model location will be converted // from |source| coordinate system to |target| coordinate system. @@ -303,9 +278,6 @@ class VIEWS_EXPORT TouchEvent : public LocatedEvent { class VIEWS_EXPORT KeyEvent : public Event { public: explicit KeyEvent(const NativeEvent& native_event); -#if defined(TOOLKIT_USES_GTK) - explicit KeyEvent(GdkEvent* gdk_event); -#endif // Creates a new KeyEvent synthetically (i.e. not in response to an input // event from the host environment). This is typically only used in testing as @@ -359,9 +331,6 @@ class VIEWS_EXPORT MouseWheelEvent : public MouseEvent { static const int kWheelDelta; explicit MouseWheelEvent(const NativeEvent& native_event); -#if defined(TOOLKIT_USES_GTK) - explicit MouseWheelEvent(GdkEvent* gdk_event); -#endif explicit MouseWheelEvent(const ScrollEvent& scroll_event); // The amount to scroll. This is in multiples of kWheelDelta. diff --git a/ui/views/events/event_x.cc b/ui/views/events/event_x.cc index e546ad8..819bee4 100644 --- a/ui/views/events/event_x.cc +++ b/ui/views/events/event_x.cc @@ -19,27 +19,6 @@ namespace views { -namespace { - -// The following two functions are copied from event_gtk.cc. These will be -// removed when GTK dependency is removed. -#if defined(TOOLKIT_USES_GTK) -uint16 GetCharacterFromGdkKeyval(guint keyval) { - guint32 ch = gdk_keyval_to_unicode(keyval); - - // We only support BMP characters. - return ch < 0xFFFE ? static_cast<uint16>(ch) : 0; -} - -GdkEventKey* GetGdkEventKeyFromNative(GdkEvent* gdk_event) { - DCHECK(gdk_event->type == GDK_KEY_PRESS || - gdk_event->type == GDK_KEY_RELEASE); - return &gdk_event->key; -} -#endif - -} // namespace - //////////////////////////////////////////////////////////////////////////////// // KeyEvent, public: @@ -48,15 +27,6 @@ uint16 KeyEvent::GetCharacter() const { return character_; if (!native_event()) { -#if defined(TOOLKIT_USES_GTK) - // This event may have been created from a Gdk event. - if (!IsControlDown() && gdk_event()) { - uint16 ch = GetCharacterFromGdkKeyval( - GetGdkEventKeyFromNative(gdk_event())->keyval); - if (ch) - return ch; - } -#endif return ui::GetCharacterFromKeyCode(key_code_, flags()); } @@ -74,29 +44,6 @@ uint16 KeyEvent::GetUnmodifiedCharacter() const { return unmodified_character_; if (!native_event()) { -#if defined(TOOLKIT_USES_GTK) - // This event may have been created from a Gdk event. - if (gdk_event()) { - GdkEventKey* key = GetGdkEventKeyFromNative(gdk_event()); - - static const guint kIgnoredModifiers = - GDK_CONTROL_MASK | GDK_LOCK_MASK | GDK_MOD1_MASK | GDK_MOD2_MASK | - GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK | GDK_SUPER_MASK | - GDK_HYPER_MASK | GDK_META_MASK; - - // We can't use things like (key->state & GDK_SHIFT_MASK), as it may mask - // out bits used by X11 or Gtk internally. - GdkModifierType modifiers = - static_cast<GdkModifierType>(key->state & ~kIgnoredModifiers); - guint keyval = 0; - if (gdk_keymap_translate_keyboard_state(NULL, key->hardware_keycode, - modifiers, key->group, &keyval, NULL, NULL, NULL)) { - uint16 ch = GetCharacterFromGdkKeyval(keyval); - if (ch) - return ch; - } - } -#endif return ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); } diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc index e4f7785..f27a3e8 100644 --- a/ui/views/examples/examples_main.cc +++ b/ui/views/examples/examples_main.cc @@ -23,10 +23,6 @@ int main(int argc, char** argv) { #if defined(OS_WIN) ui::ScopedOleInitializer ole_initializer; -#elif defined(OS_LINUX) - // Initializes gtk stuff. - g_type_init(); - gtk_init(&argc, &argv); #endif CommandLine::Init(argc, argv); diff --git a/ui/views/focus/accelerator_handler.h b/ui/views/focus/accelerator_handler.h index c8644a3..7897294 100644 --- a/ui/views/focus/accelerator_handler.h +++ b/ui/views/focus/accelerator_handler.h @@ -8,10 +8,6 @@ #include "build/build_config.h" -#if defined(TOOLKIT_USES_GTK) -#include <gdk/gdk.h> -#endif - #include <set> #include <vector> @@ -49,8 +45,6 @@ class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { #elif defined(USE_AURA) virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( XEvent* xev) OVERRIDE; -#else - virtual bool Dispatch(GdkEvent* event) OVERRIDE; #endif private: diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc index 317a1a7..b7a4d1b 100644 --- a/ui/views/focus/focus_manager.cc +++ b/ui/views/focus/focus_manager.cc @@ -435,12 +435,6 @@ void FocusManager::MaybeResetMenuKeyState(const KeyEvent& key) { #endif } -#if defined(TOOLKIT_USES_GTK) -void FocusManager::ResetMenuKeyState() { - should_handle_menu_key_release_ = false; -} -#endif - ui::AcceleratorTarget* FocusManager::GetCurrentTargetForAccelerator( const ui::Accelerator& accelerator) const { return accelerator_manager_->GetCurrentTarget(accelerator); diff --git a/ui/views/focus/focus_manager.h b/ui/views/focus/focus_manager.h index 262444f..a0baadd 100644 --- a/ui/views/focus/focus_manager.h +++ b/ui/views/focus/focus_manager.h @@ -227,11 +227,6 @@ class VIEWS_EXPORT FocusManager { // This is effective only on x11. void MaybeResetMenuKeyState(const KeyEvent& key); -#if defined(TOOLKIT_USES_GTK) - // Resets menu key state. TODO(oshima): Remove this when views/gtk is removed. - void ResetMenuKeyState(); -#endif - // Called by a RootView when a view within its hierarchy is removed // from its parent. This will only be called by a RootView in a // hierarchy of Widgets that this FocusManager is attached to the diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc index aea5d19..01a33ab 100644 --- a/ui/views/focus/focus_manager_unittest.cc +++ b/ui/views/focus/focus_manager_unittest.cc @@ -17,10 +17,6 @@ #include "ui/views/controls/tabbed_pane/tabbed_pane.h" #endif -#if defined(OS_LINUX) -#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" -#endif - namespace views { enum FocusTestEventType { diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc index fc58df8..f0ef1f4 100644 --- a/ui/views/focus/focus_traversal_unittest.cc +++ b/ui/views/focus/focus_traversal_unittest.cc @@ -159,8 +159,6 @@ class BorderView : public NativeViewHost { Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); #if defined(OS_WIN) || defined(USE_AURA) params.parent = parent->GetWidget()->GetNativeView(); -#elif defined(TOOLKIT_USES_GTK) - params.parent = native_view(); #else NOTREACHED(); #endif diff --git a/ui/views/mouse_watcher.cc b/ui/views/mouse_watcher.cc index ab68b6e..8139bf34 100644 --- a/ui/views/mouse_watcher.cc +++ b/ui/views/mouse_watcher.cc @@ -94,22 +94,6 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { break; } } -#elif defined(TOOLKIT_USES_GTK) - virtual void WillProcessEvent(GdkEvent* event) OVERRIDE { - } - - virtual void DidProcessEvent(GdkEvent* event) OVERRIDE { - switch (event->type) { - case GDK_MOTION_NOTIFY: - HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_MOVE); - break; - case GDK_LEAVE_NOTIFY: - HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_EXIT); - break; - default: - break; - } - } #endif private: diff --git a/ui/views/view.cc b/ui/views/view.cc index dcc4e84..1fa7dc7 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc @@ -37,9 +37,6 @@ #include "base/win/scoped_gdi_object.h" #include "ui/views/accessibility/native_view_accessibility_win.h" #endif -#if defined(TOOLKIT_USES_GTK) -#include "ui/base/gtk/scoped_region.h" -#endif namespace { @@ -785,9 +782,6 @@ bool View::HitTest(const gfx::Point& l) const { #elif defined(OS_WIN) base::win::ScopedRegion rgn(mask.CreateNativeRegion()); return !!PtInRegion(rgn, l.x(), l.y()); -#elif defined(TOOLKIT_USES_GTK) - ui::ScopedRegion rgn(mask.CreateNativeRegion()); - return gdk_region_point_in(rgn.Get(), l.x(), l.y()); #endif } // No mask, but inside our bounds. diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index ba97ae9..6ffedc3 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -1174,18 +1174,6 @@ void Widget::DestroyRootView() { root_view_.reset(); // Input method has to be destroyed before focus manager. input_method_.reset(); -#if defined(TOOLKIT_USES_GTK) - // Defer focus manager's destruction. This is for the case when the - // focus manager is referenced by a child NativeWidgetGtk (e.g. TabbedPane in - // a dialog). When gtk_widget_destroy is called on the parent, the destroy - // signal reaches parent first and then the child. Thus causing the parent - // NativeWidgetGtk's dtor executed before the child's. If child's view - // hierarchy references this focus manager, it crashes. This will defer focus - // manager's destruction after child NativeWidgetGtk's dtor. - FocusManager* focus_manager = focus_manager_.release(); - if (focus_manager) - MessageLoop::current()->DeleteSoon(FROM_HERE, focus_manager); -#endif } //////////////////////////////////////////////////////////////////////////////// diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index 9dad2f3..e33bb83 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -659,9 +659,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, void DestroyRootView(); private: - // TODO(beng): Remove NativeWidgetGtk's dependence on the mouse state flags. - friend class NativeWidgetGtk; - friend class NativeTextfieldViewsTest; friend class NativeComboboxViewsTest; friend class ScopedEvent; diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 143c51e..685adfc 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -18,8 +18,6 @@ #include "ui/views/widget/native_widget_aura.h" #elif defined(OS_WIN) #include "ui/views/widget/native_widget_win.h" -#elif defined(TOOLKIT_USES_GTK) -#include "ui/views/widget/native_widget_gtk.h" #endif namespace views { @@ -30,13 +28,11 @@ namespace { typedef NativeWidgetAura NativeWidgetPlatform; #elif defined(OS_WIN) typedef NativeWidgetWin NativeWidgetPlatform; -#elif defined(TOOLKIT_USES_GTK) -typedef NativeWidgetGtk NativeWidgetPlatform; #endif -// A widget that assumes mouse capture always works. It won't on Gtk/Aura in +// A widget that assumes mouse capture always works. It won't on Aura in // testing, so we mock it. -#if defined(TOOLKIT_USES_GTK) || defined(USE_AURA) +#if defined(USE_AURA) class NativeWidgetCapture : public NativeWidgetPlatform { public: NativeWidgetCapture(internal::NativeWidgetDelegate* delegate) @@ -69,8 +65,6 @@ class NativeWidgetCapture : public NativeWidgetPlatform { typedef NativeWidgetCapture NativeWidgetPlatformForTest; #elif defined(OS_WIN) typedef NativeWidgetWin NativeWidgetPlatformForTest; -#elif defined(TOOLKIT_USES_GTK) -typedef NativeWidgetCapture NativeWidgetPlatformForTest; #endif // A view that always processes all mouse events. @@ -186,13 +180,7 @@ TEST_F(WidgetTest, WidgetInitParams) { TEST_F(WidgetTest, GetTopLevelWidget_Native) { // Create a hierarchy of native widgets. Widget* toplevel = CreateTopLevelPlatformWidget(); -#if defined(TOOLKIT_USES_GTK) - NativeWidgetGtk* native_widget = - static_cast<NativeWidgetGtk*>(toplevel->native_widget()); - gfx::NativeView parent = native_widget->window_contents(); -#else gfx::NativeView parent = toplevel->GetNativeView(); -#endif Widget* child = CreateChildPlatformWidget(parent); EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget()); @@ -288,13 +276,7 @@ TEST_F(WidgetTest, ChangeActivation) { // Tests visibility of child widgets. TEST_F(WidgetTest, Visibility) { Widget* toplevel = CreateTopLevelPlatformWidget(); -#if defined(TOOLKIT_USES_GTK) - NativeWidgetGtk* native_widget = - static_cast<NativeWidgetGtk*>(toplevel->native_widget()); - gfx::NativeView parent = native_widget->window_contents(); -#else gfx::NativeView parent = toplevel->GetNativeView(); -#endif Widget* child = CreateChildPlatformWidget(parent); EXPECT_FALSE(toplevel->IsVisible()); @@ -523,12 +505,7 @@ TEST_F(WidgetOwnershipTest, Ownership_PlatformNativeWidgetOwnsWidget) { } // NativeWidget owns its Widget, part 2: NativeWidget is a NativeWidget. -#if defined(TOOLKIT_USES_GTK) -// Temporarily disable the test (http://crbug.com/104945). -TEST_F(WidgetOwnershipTest, DISABLED_Ownership_ViewsNativeWidgetOwnsWidget) { -#else TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget) { -#endif OwnershipTestState state; Widget* toplevel = CreateTopLevelPlatformWidget(); @@ -568,8 +545,6 @@ TEST_F(WidgetOwnershipTest, delete widget->GetNativeView(); #elif defined(OS_WIN) DestroyWindow(widget->GetNativeView()); -#elif defined(TOOLKIT_USES_GTK) - gtk_widget_destroy(widget->GetNativeView()); #endif EXPECT_TRUE(state.widget_deleted); @@ -578,14 +553,8 @@ TEST_F(WidgetOwnershipTest, // NativeWidget owns its Widget, part 4: NativeWidget is a NativeWidget, // destroyed by the view hierarchy that contains it. -#if defined(TOOLKIT_USES_GTK) -// Temporarily disable the test (http://crbug.com/104945). -TEST_F(WidgetOwnershipTest, - DISABLED_Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) { -#else TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) { -#endif OwnershipTestState state; Widget* toplevel = CreateTopLevelPlatformWidget(); diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index 264908f..8c9d9f8 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc @@ -10,8 +10,6 @@ #include <windows.h> #include <uxtheme.h> #include <vsstyle.h> -#elif defined(TOOLKIT_USES_GTK) -#include <gtk/gtk.h> #endif #include <algorithm> @@ -24,18 +22,13 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" +#include "ui/gfx/native_theme.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/layout/layout_constants.h" #include "ui/views/widget/root_view.h" #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" -#if defined(OS_WIN) -#include "ui/gfx/native_theme.h" -#else -#include "ui/gfx/skia_utils_gtk.h" -#endif - namespace views { namespace { @@ -312,19 +305,8 @@ const DialogClientView* DialogClientView::AsDialogClientView() const { // DialogClientView, View overrides: void DialogClientView::OnPaint(gfx::Canvas* canvas) { -#if defined(TOOLKIT_USES_GTK) - // TODO(benrg): Unfortunately, GetSystemColor often returns the wrong color - // under GTK right now. This is meant to be a temporary fix. See related TODO - // in ui/gfx/native_theme_gtk.cc. - GtkWidget* widget = GetWidget()->GetNativeView(); - if (!GTK_IS_WINDOW(widget)) - return; - SkColor bg_color = gfx::GdkColorToSkColor( - gtk_widget_get_style(widget)->bg[GTK_STATE_NORMAL]); -#else SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor( gfx::NativeTheme::kColorId_DialogBackground); -#endif canvas->FillRect(GetLocalBounds(), bg_color); } |