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

Unified Diff: ash/accelerators/focus_manager_factory.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: final rebase 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/focus_manager_factory.h ('k') | ash/ash.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/focus_manager_factory.cc
diff --git a/ash/accelerators/focus_manager_factory.cc b/ash/accelerators/focus_manager_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..76dcd9f6933a7bae6cafe6b68ccf15c4bfe0aa8e
--- /dev/null
+++ b/ash/accelerators/focus_manager_factory.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/accelerators/focus_manager_factory.h"
+
+#include "ash/accelerators/accelerator_controller.h"
+#include "ash/shell.h"
+#include "ui/views/focus/focus_manager.h"
+
+namespace ash {
+
+AshFocusManagerFactory::AshFocusManagerFactory() {}
+AshFocusManagerFactory::~AshFocusManagerFactory() {}
+
+views::FocusManager* AshFocusManagerFactory::CreateFocusManager(
+ views::Widget* widget) {
+ return new views::FocusManager(widget, new Delegate);
+}
+
+bool AshFocusManagerFactory::Delegate::ProcessAccelerator(
+ const ui::Accelerator& accelerator) {
+ AcceleratorController* controller =
+ Shell::GetInstance()->accelerator_controller();
+ if (controller)
+ return controller->Process(accelerator);
+ return false;
+}
+
+ui::AcceleratorTarget*
+AshFocusManagerFactory::Delegate::GetCurrentTargetForAccelerator(
+ const ui::Accelerator& accelerator) const {
+ AcceleratorController* controller =
+ Shell::GetInstance()->accelerator_controller();
+ if (controller && controller->IsRegistered(accelerator))
+ return controller;
+ return NULL;
+}
+
+} // namespace ash
« no previous file with comments | « ash/accelerators/focus_manager_factory.h ('k') | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698