summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 17:25:00 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 17:25:00 +0000
commitb30364162f534b703445dca0976897cc372b267d (patch)
treee724a9428b7755d686e9f410a42aec3f73782dc7
parent591fc8297784d8c8846161e033bf7a6450d4938f (diff)
downloadchromium_src-b30364162f534b703445dca0976897cc372b267d.zip
chromium_src-b30364162f534b703445dca0976897cc372b267d.tar.gz
chromium_src-b30364162f534b703445dca0976897cc372b267d.tar.bz2
aura: Remove an unnecessary parameter from DispatcherClient::RunWithDispatcher.
The |nestable_tasks_allowed| parameter was always being set to true from the callsites. So get rid of the variable, and use ScopedNestableTaskAllower in the RunWithDispatcher implementations. BUG=none R=sky@chromium.org Review URL: https://codereview.chromium.org/162633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251072 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/accelerators/nested_dispatcher_controller.cc7
-rw-r--r--ash/accelerators/nested_dispatcher_controller.h3
-rw-r--r--ash/accelerators/nested_dispatcher_controller_unittest.cc9
-rw-r--r--chrome/browser/ui/views/first_run_dialog.cc2
-rw-r--r--chrome/browser/ui/views/simple_message_box_views.cc2
-rw-r--r--ui/aura/client/dispatcher_client.h3
-rw-r--r--ui/views/controls/menu/menu_controller_aura.cc2
-rw-r--r--ui/views/widget/desktop_aura/desktop_dispatcher_client.cc9
-rw-r--r--ui/views/widget/desktop_aura/desktop_dispatcher_client.h3
9 files changed, 13 insertions, 27 deletions
diff --git a/ash/accelerators/nested_dispatcher_controller.cc b/ash/accelerators/nested_dispatcher_controller.cc
index d30d66d..c551e94 100644
--- a/ash/accelerators/nested_dispatcher_controller.cc
+++ b/ash/accelerators/nested_dispatcher_controller.cc
@@ -18,11 +18,9 @@ NestedDispatcherController::~NestedDispatcherController() {
void NestedDispatcherController::RunWithDispatcher(
base::MessagePumpDispatcher* nested_dispatcher,
- aura::Window* associated_window,
- bool nestable_tasks_allowed) {
+ aura::Window* associated_window) {
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
- bool did_allow_task_nesting = loop->NestableTasksAllowed();
- loop->SetNestableTasksAllowed(nestable_tasks_allowed);
+ base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
AcceleratorDispatcher dispatcher(nested_dispatcher, associated_window);
@@ -30,7 +28,6 @@ void NestedDispatcherController::RunWithDispatcher(
// use run_loop.QuitClosure().
base::RunLoop run_loop(&dispatcher);
run_loop.Run();
- loop->SetNestableTasksAllowed(did_allow_task_nesting);
}
} // namespace ash
diff --git a/ash/accelerators/nested_dispatcher_controller.h b/ash/accelerators/nested_dispatcher_controller.h
index b0c2b9a..958cbae 100644
--- a/ash/accelerators/nested_dispatcher_controller.h
+++ b/ash/accelerators/nested_dispatcher_controller.h
@@ -23,8 +23,7 @@ class ASH_EXPORT NestedDispatcherController
virtual ~NestedDispatcherController();
virtual void RunWithDispatcher(base::MessagePumpDispatcher* dispatcher,
- aura::Window* associated_window,
- bool nestable_tasks_allowed) OVERRIDE;
+ aura::Window* associated_window) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(NestedDispatcherController);
diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc
index 41a6e9a..3749c7f 100644
--- a/ash/accelerators/nested_dispatcher_controller_unittest.cc
+++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc
@@ -109,8 +109,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) {
aura::Window* root_window = ash::Shell::GetPrimaryRootWindow();
aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
&inner_dispatcher,
- associated_window.get(),
- true /* nestable_tasks_allowed */);
+ associated_window.get());
EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
Shell::GetInstance()->session_state_delegate()->UnlockScreen();
}
@@ -130,8 +129,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) {
aura::Window* root_window = ash::Shell::GetPrimaryRootWindow();
aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
&inner_dispatcher,
- associated_window.get(),
- true /* nestable_tasks_allowed */);
+ associated_window.get());
EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched());
}
@@ -149,8 +147,7 @@ TEST_F(NestedDispatcherTest, AcceleratorsHandled) {
DispatchKeyReleaseA();
aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
&inner_dispatcher,
- root_window,
- true /* nestable_tasks_allowed */);
+ root_window);
EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
EXPECT_EQ(1, target.accelerator_pressed_count());
}
diff --git a/chrome/browser/ui/views/first_run_dialog.cc b/chrome/browser/ui/views/first_run_dialog.cc
index c3da39a..d6b554e 100644
--- a/chrome/browser/ui/views/first_run_dialog.cc
+++ b/chrome/browser/ui/views/first_run_dialog.cc
@@ -65,7 +65,7 @@ bool FirstRunDialog::Show(Profile* profile) {
aura::Window* anchor = dialog->GetWidget()->GetNativeWindow();
aura::client::DispatcherClient* client =
aura::client::GetDispatcherClient(anchor->GetRootWindow());
- client->RunWithDispatcher(dialog, anchor, true);
+ client->RunWithDispatcher(dialog, anchor);
dialog_shown = true;
}
#endif // defined(GOOGLE_CHROME_BUILD)
diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc
index f71bce2..3e85e68 100644
--- a/chrome/browser/ui/views/simple_message_box_views.cc
+++ b/chrome/browser/ui/views/simple_message_box_views.cc
@@ -213,7 +213,7 @@ MessageBoxResult ShowMessageBoxImpl(gfx::NativeWindow parent,
anchor = dialog->GetWidget()->GetNativeWindow();
client = aura::client::GetDispatcherClient(anchor->GetRootWindow());
}
- client->RunWithDispatcher(dialog.get(), anchor, true);
+ client->RunWithDispatcher(dialog.get(), anchor);
return dialog->result();
}
diff --git a/ui/aura/client/dispatcher_client.h b/ui/aura/client/dispatcher_client.h
index 8e5e1ec..ae8c84c 100644
--- a/ui/aura/client/dispatcher_client.h
+++ b/ui/aura/client/dispatcher_client.h
@@ -17,8 +17,7 @@ namespace client {
class AURA_EXPORT DispatcherClient {
public:
virtual void RunWithDispatcher(base::MessagePumpDispatcher* dispatcher,
- aura::Window* associated_window,
- bool nestable_tasks_allowed) = 0;
+ aura::Window* associated_window) = 0;
};
AURA_EXPORT void SetDispatcherClient(Window* root_window,
diff --git a/ui/views/controls/menu/menu_controller_aura.cc b/ui/views/controls/menu/menu_controller_aura.cc
index 48bf311..7045651 100644
--- a/ui/views/controls/menu/menu_controller_aura.cc
+++ b/ui/views/controls/menu/menu_controller_aura.cc
@@ -90,7 +90,7 @@ void MenuController::RunMessageLoop(bool nested_menu) {
if (!nested_menu)
observer.reset(new ActivationChangeObserverImpl(this, root));
aura::client::GetDispatcherClient(root)->
- RunWithDispatcher(this, owner_->GetNativeWindow(), true);
+ RunWithDispatcher(this, owner_->GetNativeWindow());
} else {
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
base::MessageLoop::ScopedNestableTaskAllower allow(loop);
diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
index 212a6a4..be251da 100644
--- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_dispatcher_client.cc
@@ -14,21 +14,16 @@ DesktopDispatcherClient::~DesktopDispatcherClient() {}
void DesktopDispatcherClient::RunWithDispatcher(
base::MessagePumpDispatcher* nested_dispatcher,
- aura::Window* associated_window,
- bool nestable_tasks_allowed) {
+ aura::Window* associated_window) {
// TODO(erg): This class has been copypastad from
// ash/accelerators/nested_dispatcher_controller.cc. I have left my changes
// commented out because I don't entirely understand the implications of the
// change.
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
- bool did_allow_task_nesting = loop->NestableTasksAllowed();
- loop->SetNestableTasksAllowed(nestable_tasks_allowed);
+ base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
- // DefaultAcceleratorDispatcher dispatcher(nested_dispatcher,
- // associated_window);
base::RunLoop run_loop(nested_dispatcher);
run_loop.Run();
- loop->SetNestableTasksAllowed(did_allow_task_nesting);
}
} // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
index dfc5179..b59f4da 100644
--- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
+++ b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
@@ -19,8 +19,7 @@ class VIEWS_EXPORT DesktopDispatcherClient
virtual ~DesktopDispatcherClient();
virtual void RunWithDispatcher(base::MessagePumpDispatcher* dispatcher,
- aura::Window* associated_window,
- bool nestable_tasks_allowed) OVERRIDE;
+ aura::Window* associated_window) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(DesktopDispatcherClient);