1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/accelerators/nested_dispatcher_controller.h"
7 #include "ash/accelerators/accelerator_dispatcher.h"
9 #include "base/run_loop.h"
13 NestedDispatcherController::NestedDispatcherController() {
16 NestedDispatcherController::~NestedDispatcherController() {
19 void NestedDispatcherController::RunWithDispatcher(
20 base::MessageLoop::Dispatcher
* nested_dispatcher
,
21 aura::Window
* associated_window
,
22 bool nestable_tasks_allowed
) {
23 base::MessageLoopForUI
* loop
= base::MessageLoopForUI::current();
24 bool did_allow_task_nesting
= loop
->NestableTasksAllowed();
25 loop
->SetNestableTasksAllowed(nestable_tasks_allowed
);
27 AcceleratorDispatcher
dispatcher(nested_dispatcher
, associated_window
);
29 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
30 // use run_loop.QuitClosure().
31 base::RunLoop
run_loop(&dispatcher
);
33 loop
->SetNestableTasksAllowed(did_allow_task_nesting
);