Fix fling boosting
[chromium-blink-merge.git] / ash / accelerators / focus_manager_factory.cc
blob0695fd3e7a099318ae1e973ba03899ef78bd4ba2
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/focus_manager_factory.h"
7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/shell.h"
9 #include "ui/views/focus/focus_manager.h"
11 namespace ash {
13 AshFocusManagerFactory::AshFocusManagerFactory() {}
14 AshFocusManagerFactory::~AshFocusManagerFactory() {}
16 views::FocusManager* AshFocusManagerFactory::CreateFocusManager(
17 views::Widget* widget,
18 bool desktop_widget) {
19 return new views::FocusManager(widget, desktop_widget ? NULL : new Delegate);
22 bool AshFocusManagerFactory::Delegate::ProcessAccelerator(
23 const ui::Accelerator& accelerator) {
24 AcceleratorController* controller =
25 Shell::GetInstance()->accelerator_controller();
26 if (controller)
27 return controller->Process(accelerator);
28 return false;
31 ui::AcceleratorTarget*
32 AshFocusManagerFactory::Delegate::GetCurrentTargetForAccelerator(
33 const ui::Accelerator& accelerator) const {
34 AcceleratorController* controller =
35 Shell::GetInstance()->accelerator_controller();
36 if (controller && controller->IsRegistered(accelerator))
37 return controller;
38 return NULL;
41 } // namespace ash