summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 20:58:23 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 20:58:23 +0000
commit42968f7ecad14b81cf9187d2b3e7fbb27b93808d (patch)
treefbcd9263853ca68ccea8fae6769cd3f82fda704b /ui
parentbbd0532177fc8b10c17b243595460135080b0ff0 (diff)
downloadchromium_src-42968f7ecad14b81cf9187d2b3e7fbb27b93808d.zip
chromium_src-42968f7ecad14b81cf9187d2b3e7fbb27b93808d.tar.gz
chromium_src-42968f7ecad14b81cf9187d2b3e7fbb27b93808d.tar.bz2
Remove unnecessary uses of aura::Env::GetDispatcher
Avoid using aura::Env::GetDispatcher() as the dispatcher for new instances of base::RunLoop()s, since for both Windows and X11, it's the same as the message-pump. This patch also removes some non-aura views code, and some unnecessary USE_AURA ifdefs. R=darin@chromium.org, sky@chromium.org Review URL: https://codereview.chromium.org/154203002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/env.cc3
-rw-r--r--ui/aura/gestures/gesture_recognizer_unittest.cc3
-rw-r--r--ui/aura/root_window_unittest.cc3
-rw-r--r--ui/aura/test/aura_test_helper.cc2
-rw-r--r--ui/base/x/selection_requestor.cc2
-rw-r--r--ui/gfx/font_smoothing_win.cc2
-rw-r--r--ui/views/bubble/bubble_delegate_unittest.cc12
-rw-r--r--ui/views/controls/menu/menu_controller.cc4
-rw-r--r--ui/views/controls/menu/menu_controller.h2
-rw-r--r--ui/views/focus/accelerator_handler.h6
-rw-r--r--ui/views/focus/accelerator_handler_aura.cc6
-rw-r--r--ui/views/test/views_test_base.cc16
-rw-r--r--ui/views/test/views_test_base.h2
-rw-r--r--ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc2
-rw-r--r--ui/views/widget/widget_interactive_uitest.cc3
15 files changed, 9 insertions, 59 deletions
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index cd98057..db6af7b 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -93,8 +93,7 @@ void Env::RootWindowActivated(RootWindow* root_window) {
// Env, private:
void Env::Init() {
-#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(USE_X11) && \
- !defined(USE_OZONE)
+#if defined(OS_WIN)
dispatcher_.reset(CreateDispatcher());
#endif
#if defined(USE_X11)
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index 76b9b21..a3fa4d2 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -205,8 +205,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
void WaitUntilReceivedGesture(ui::EventType type) {
wait_until_event_ = type;
- run_loop_.reset(new base::RunLoop(
- Env::GetInstance()->GetDispatcher()));
+ run_loop_.reset(new base::RunLoop());
run_loop_->Run();
}
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index abf8947..3fcfee2 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -443,8 +443,7 @@ class EventFilterRecorder : public ui::EventHandler {
void WaitUntilReceivedEvent(ui::EventType type) {
wait_until_event_ = type;
- run_loop_.reset(new base::RunLoop(
- Env::GetInstance()->GetDispatcher()));
+ run_loop_.reset(new base::RunLoop());
run_loop_->Run();
}
diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc
index a101eda..0175eac 100644
--- a/ui/aura/test/aura_test_helper.cc
+++ b/ui/aura/test/aura_test_helper.cc
@@ -115,7 +115,7 @@ void AuraTestHelper::TearDown() {
void AuraTestHelper::RunAllPendingInMessageLoop() {
// TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
// use run_loop.QuitClosure().
- base::RunLoop run_loop(Env::GetInstance()->GetDispatcher());
+ base::RunLoop run_loop;
run_loop.RunUntilIdle();
}
diff --git a/ui/base/x/selection_requestor.cc b/ui/base/x/selection_requestor.cc
index dd7a310..f044cf8 100644
--- a/ui/base/x/selection_requestor.cc
+++ b/ui/base/x/selection_requestor.cc
@@ -53,7 +53,7 @@ bool SelectionRequestor::PerformBlockingConvertSelection(
// for a response.
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
- base::RunLoop run_loop(base::MessagePumpX11::Current());
+ base::RunLoop run_loop;
PendingRequest pending_request(target, run_loop.QuitClosure());
pending_requests_.push_back(&pending_request);
diff --git a/ui/gfx/font_smoothing_win.cc b/ui/gfx/font_smoothing_win.cc
index b181fb5..78309ff 100644
--- a/ui/gfx/font_smoothing_win.cc
+++ b/ui/gfx/font_smoothing_win.cc
@@ -36,7 +36,7 @@ class CachedFontSmoothingSettings : public gfx::SingletonHwnd::Observer {
// Queries the font settings from the system.
void QueryFontSettings();
- // Indicates whether the MessagePumpObserver has been registered.
+ // Indicates whether the SingletonHwnd::Observer has been registered.
bool observer_added_;
// Indicates whether |smoothing_enabled_| and |cleartype_enabled_| are valid
diff --git a/ui/views/bubble/bubble_delegate_unittest.cc b/ui/views/bubble/bubble_delegate_unittest.cc
index 7e2c718f..c88cf55 100644
--- a/ui/views/bubble/bubble_delegate_unittest.cc
+++ b/ui/views/bubble/bubble_delegate_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/run_loop.h"
+#include "ui/aura/env.h"
#include "ui/base/hit_test.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_frame_view.h"
@@ -11,10 +12,6 @@
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
-#if defined(USE_AURA)
-#include "ui/aura/env.h"
-#endif
-
namespace views {
namespace {
@@ -105,12 +102,10 @@ TEST_F(BubbleDelegateTest, CloseAnchorWidget) {
EXPECT_EQ(anchor_widget, bubble_delegate->anchor_widget());
EXPECT_FALSE(bubble_observer.widget_closed());
-#if defined(USE_AURA)
// TODO(msw): Remove activation hack to prevent bookkeeping errors in:
// aura::test::TestActivationClient::OnWindowDestroyed().
scoped_ptr<Widget> smoke_and_mirrors_widget(CreateTestWidget());
EXPECT_FALSE(bubble_observer.widget_closed());
-#endif
// Ensure that closing the anchor widget also closes the bubble itself.
anchor_widget->CloseNow();
@@ -198,12 +193,10 @@ TEST_F(BubbleDelegateTest, ResetAnchorWidget) {
EXPECT_NE(anchor_widget, bubble_delegate->anchor_widget());
EXPECT_FALSE(bubble_observer.widget_closed());
-#if defined(USE_AURA)
// TODO(msw): Remove activation hack to prevent bookkeeping errors in:
// aura::test::TestActivationClient::OnWindowDestroyed().
scoped_ptr<Widget> smoke_and_mirrors_widget(CreateTestWidget());
EXPECT_FALSE(bubble_observer.widget_closed());
-#endif
// Ensure that closing the parent widget also closes the bubble itself.
parent_widget->CloseNow();
@@ -265,10 +258,7 @@ class BubbleWidgetClosingTest : public BubbleDelegateTest,
public views::WidgetObserver {
public:
BubbleWidgetClosingTest() : bubble_destroyed_(false) {
-#if defined(USE_AURA)
aura::Env::CreateInstance();
- loop_.set_dispatcher(aura::Env::GetInstance()->GetDispatcher());
-#endif
}
virtual ~BubbleWidgetClosingTest() {}
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index cb336e8..d73e78c 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -596,13 +596,11 @@ void MenuController::OnMouseEntered(SubmenuView* source,
// do anything here.
}
-#if defined(USE_AURA)
bool MenuController::OnMouseWheel(SubmenuView* source,
const ui::MouseWheelEvent& event) {
MenuPart part = GetMenuPart(source, event.location());
return part.submenu && part.submenu->OnMouseWheel(event);
}
-#endif
void MenuController::OnGestureEvent(SubmenuView* source,
ui::GestureEvent* event) {
@@ -1061,7 +1059,7 @@ bool MenuController::Dispatch(const MSG& msg) {
DispatchMessage(&msg);
return exit_type_ == EXIT_NONE;
}
-#elif defined(USE_AURA)
+#else
bool MenuController::Dispatch(const base::NativeEvent& event) {
if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) {
aura::Env::GetInstance()->GetDispatcher()->Dispatch(event);
diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h
index a834459..da56099 100644
--- a/ui/views/controls/menu/menu_controller.h
+++ b/ui/views/controls/menu/menu_controller.h
@@ -112,9 +112,7 @@ class VIEWS_EXPORT MenuController : public base::MessagePumpDispatcher,
void OnMouseReleased(SubmenuView* source, const ui::MouseEvent& event);
void OnMouseMoved(SubmenuView* source, const ui::MouseEvent& event);
void OnMouseEntered(SubmenuView* source, const ui::MouseEvent& event);
-#if defined(USE_AURA)
bool OnMouseWheel(SubmenuView* source, const ui::MouseWheelEvent& event);
-#endif
void OnGestureEvent(SubmenuView* source, ui::GestureEvent* event);
bool GetDropFormats(
diff --git a/ui/views/focus/accelerator_handler.h b/ui/views/focus/accelerator_handler.h
index cf0a880..c4fe18c 100644
--- a/ui/views/focus/accelerator_handler.h
+++ b/ui/views/focus/accelerator_handler.h
@@ -17,12 +17,6 @@
namespace views {
-#if defined(USE_AURA) && defined(USE_X11)
-// Dispatch an XEvent to the RootView. Return true if the event was dispatched
-// and handled, false otherwise.
-bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent);
-#endif // USE_AURA && USE_X11
-
// This class delegates the key messages to the associated FocusManager class
// for the window that is receiving these messages for accelerator processing.
class VIEWS_EXPORT AcceleratorHandler : public base::MessagePumpDispatcher {
diff --git a/ui/views/focus/accelerator_handler_aura.cc b/ui/views/focus/accelerator_handler_aura.cc
index 8daa0f39..04fe3f4 100644
--- a/ui/views/focus/accelerator_handler_aura.cc
+++ b/ui/views/focus/accelerator_handler_aura.cc
@@ -17,10 +17,4 @@ bool AcceleratorHandler::Dispatch(const base::NativeEvent& event) {
return true;
}
-#if defined(USE_X11)
-bool DispatchXEvent(XEvent* xev) {
- return false;
-}
-#endif // defined(USE_X11)
-
} // namespace views
diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc
index 37085e3..71b4204 100644
--- a/ui/views/test/views_test_base.cc
+++ b/ui/views/test/views_test_base.cc
@@ -7,14 +7,11 @@
#include "base/run_loop.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/ime/input_method_initializer.h"
-
-#if defined(USE_AURA)
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/aura_test_helper.h"
#include "ui/views/corewm/capture_controller.h"
#include "ui/views/corewm/wm_state.h"
-#endif
namespace views {
@@ -35,12 +32,10 @@ void ViewsTestBase::SetUp() {
setup_called_ = true;
if (!views_delegate_.get())
views_delegate_.reset(new TestViewsDelegate());
-#if defined(USE_AURA)
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
bool allow_test_contexts = true;
aura_test_helper_->SetUp(allow_test_contexts);
wm_state_.reset(new views::corewm::WMState);
-#endif // USE_AURA
ui::InitializeInputMethodForTesting();
}
@@ -54,36 +49,25 @@ void ViewsTestBase::TearDown() {
views_delegate_.reset();
testing::Test::TearDown();
ui::ShutdownInputMethodForTesting();
-#if defined(USE_AURA)
aura_test_helper_->TearDown();
wm_state_.reset();
CHECK(!corewm::ScopedCaptureClient::IsActive());
-#endif // USE_AURA
}
void ViewsTestBase::RunPendingMessages() {
base::RunLoop run_loop;
-#if defined(USE_AURA)
- run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher());
-#endif
run_loop.RunUntilIdle();
}
Widget::InitParams ViewsTestBase::CreateParams(
Widget::InitParams::Type type) {
Widget::InitParams params(type);
-#if defined(USE_AURA)
params.context = aura_test_helper_->root_window();
-#endif
return params;
}
gfx::NativeView ViewsTestBase::GetContext() {
-#if defined(USE_AURA)
return aura_test_helper_->root_window();
-#else
- return NULL;
-#endif
}
} // namespace views
diff --git a/ui/views/test/views_test_base.h b/ui/views/test/views_test_base.h
index 1f326fe..d7423952 100644
--- a/ui/views/test/views_test_base.h
+++ b/ui/views/test/views_test_base.h
@@ -55,10 +55,8 @@ class ViewsTestBase : public testing::Test {
private:
base::MessageLoopForUI message_loop_;
scoped_ptr<TestViewsDelegate> views_delegate_;
-#if defined(USE_AURA)
scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
scoped_ptr<views::corewm::WMState> wm_state_;
-#endif
bool setup_called_;
bool teardown_called_;
diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
index 966a791..865706a 100644
--- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
+++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc
@@ -122,7 +122,7 @@ bool X11WholeScreenMoveLoop::RunMoveLoop(aura::Window* source,
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
- base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
+ base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
return true;
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
index 40e3cb4..ddc6e65 100644
--- a/ui/views/widget/widget_interactive_uitest.cc
+++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -134,9 +134,6 @@ class NestedLoopCaptureView : public View {
base::MessageLoop::ScopedNestableTaskAllower allow(loop);
base::RunLoop run_loop;
-#if defined(USE_AURA)
- run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher());
-#endif
run_loop.Run();
return true;
}