Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: ash/shell.cc

Issue 10134036: Let Chrome app handle Ash accelerators first if the app is launched as a window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fix Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_filter_unittest.cc ('k') | chrome/browser/browser_keyevents_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index bc8829a1fa9de4936c7361af2d090eb71d965a84..617cc8a56051a12f6330389e92aa6f4627b03cad 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,15 @@
#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/compositor/layer.h"
#include "ui/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_delegate.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 +502,46 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate);
};
+class AshFocusManagerFactory : public views::FocusManagerFactory {
Ben Goodger (Google) 2012/05/07 15:42:51 Can we move this closer to the accelerators stuff
Yusuke Sato 2012/05/08 02:15:57 Done.
+ public:
+ AshFocusManagerFactory() {}
+ virtual ~AshFocusManagerFactory() {}
+
+ protected:
+ virtual views::FocusManager* CreateFocusManager(Widget* widget) OVERRIDE {
+ return new views::FocusManager(widget, new Delegate);
+ }
+
+ private:
+ class Delegate : public views::FocusManagerDelegate {
+ public:
+ // views::FocusManagerDelegate overrides:
+ virtual bool ProcessAccelerator(
+ const ui::Accelerator& accelerator) OVERRIDE {
+#if !defined(OS_MACOSX)
Ben Goodger (Google) 2012/05/07 15:42:51 dhollowa has become distracted from implementing M
Yusuke Sato 2012/05/08 02:15:57 Done.
+ AcceleratorController* controller =
+ Shell::GetInstance()->accelerator_controller();
+ if (controller)
+ return controller->Process(accelerator);
+#endif
+ return false;
+ }
+
+ virtual ui::AcceleratorTarget* GetCurrentTargetForAccelerator(
+ const ui::Accelerator& accelerator) const OVERRIDE {
+#if !defined(OS_MACOSX)
+ AcceleratorController* controller =
+ Shell::GetInstance()->accelerator_controller();
+ if (controller && controller->IsRegistered(accelerator))
+ return controller;
+#endif
+ return NULL;
+ }
+ };
+
+ DISALLOW_COPY_AND_ASSIGN(AshFocusManagerFactory);
+};
+
} // namespace
// static
@@ -543,6 +587,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 +787,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) {
« no previous file with comments | « ash/accelerators/accelerator_filter_unittest.cc ('k') | chrome/browser/browser_keyevents_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698