This source file includes following definitions.
- RunWithDispatcher
- QuitNestedMessageLoop
#include "ash/accelerators/nested_dispatcher_controller.h"
#include "ash/accelerators/accelerator_dispatcher.h"
#include "ash/shell.h"
#include "base/auto_reset.h"
#include "base/run_loop.h"
namespace ash {
NestedDispatcherController::NestedDispatcherController() {
}
NestedDispatcherController::~NestedDispatcherController() {
}
void NestedDispatcherController::RunWithDispatcher(
base::MessagePumpDispatcher* nested_dispatcher) {
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
AcceleratorDispatcher dispatcher(nested_dispatcher);
base::RunLoop run_loop(&dispatcher);
base::AutoReset<base::Closure> reset_closure(&quit_closure_,
run_loop.QuitClosure());
run_loop.Run();
}
void NestedDispatcherController::QuitNestedMessageLoop() {
CHECK(!quit_closure_.is_null());
quit_closure_.Run();
}
}