Index: ash/shell.cc |
diff --git a/ash/shell.cc b/ash/shell.cc |
index 36391fdde992dfff2d6a42ac65333d1b76508757..8f33f6a13022c311d2f50aafb82b505970d520f1 100644 |
--- a/ash/shell.cc |
+++ b/ash/shell.cc |
@@ -6,6 +6,7 @@ |
#include <algorithm> |
+#include "ash/accelerators/accelerator_table.h" |
#include "ash/app_list/app_list.h" |
#include "ash/ash_switches.h" |
#include "ash/desktop_background/desktop_background_controller.h" |
@@ -70,12 +71,14 @@ |
#include "ui/aura/root_window.h" |
#include "ui/aura/ui_controls_aura.h" |
#include "ui/aura/window.h" |
+#include "ui/base/accelerators/accelerator_manager.h" |
#include "ui/gfx/compositor/layer.h" |
#include "ui/gfx/compositor/layer_animator.h" |
#include "ui/gfx/monitor.h" |
#include "ui/gfx/screen.h" |
#include "ui/gfx/size.h" |
#include "ui/ui_controls/ui_controls.h" |
+#include "ui/views/focus/focus_manager_factory.h" |
#include "ui/views/widget/native_widget_aura.h" |
#include "ui/views/widget/widget.h" |
@@ -498,6 +501,37 @@ class DummySystemTrayDelegate : public SystemTrayDelegate { |
DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); |
}; |
+class AshFocusManagerFactory : public views::FocusManagerFactory { |
+ public: |
+ AshFocusManagerFactory() {} |
+ virtual ~AshFocusManagerFactory() {} |
+ |
+ protected: |
+ virtual views::FocusManager* CreateFocusManager(Widget* widget) OVERRIDE { |
+ views::FocusManager* manager = new views::FocusManager(widget); |
+#if !defined(OS_MACOSX) |
Ben Goodger (Google)
2012/05/04 16:25:33
why the OS_MACOSX?
Yusuke Sato
2012/05/07 08:27:28
Because accelerator_controller() is currently not
|
+ AcceleratorController* target = |
+ Shell::GetInstance()->accelerator_controller(); |
+ DCHECK(target); |
+ for (size_t i = 0; i < kAcceleratorDataLength; ++i) { |
+ ui::Accelerator accelerator(kAcceleratorData[i].keycode, |
+ kAcceleratorData[i].shift, |
+ kAcceleratorData[i].ctrl, |
+ kAcceleratorData[i].alt); |
+ accelerator.set_type(kAcceleratorData[i].trigger_on_press ? |
+ ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); |
+ manager->RegisterAccelerator(accelerator, |
+ ui::AcceleratorManager::kNormalPriority, |
+ target); |
Ben Goodger (Google)
2012/05/04 16:25:33
This injection makes me a little scared. Is there
Yusuke Sato
2012/05/07 08:27:28
Done.
On 2012/05/04 16:25:33, Ben Goodger (Google
|
+ } |
+#endif |
+ return manager; |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(AshFocusManagerFactory); |
+}; |
+ |
} // namespace |
// static |
@@ -543,6 +577,8 @@ Shell::Shell(ShellDelegate* delegate) |
} |
Shell::~Shell() { |
+ views::FocusManagerFactory::Install(NULL); |
+ |
RemoveRootWindowEventFilter(key_rewriter_filter_.get()); |
RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
RemoveRootWindowEventFilter(input_method_filter_.get()); |
@@ -741,6 +777,8 @@ void Shell::Init() { |
window_cycle_controller_.reset(new WindowCycleController); |
monitor_controller_.reset(new internal::MonitorController); |
screen_dimmer_.reset(new internal::ScreenDimmer); |
+ |
+ views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
} |
aura::Window* Shell::GetContainer(int container_id) { |