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

Unified Diff: ash/mus/accelerators/accelerator_controller_registrar.cc

Issue 2769213005: Adds kWillProcessAccelerator_KeyEventProperty (Closed)
Patch Set: cleanup Created 3 years, 9 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/common/accelerators/accelerator_controller.cc ('k') | ash/public/interfaces/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/accelerators/accelerator_controller_registrar.cc
diff --git a/ash/mus/accelerators/accelerator_controller_registrar.cc b/ash/mus/accelerators/accelerator_controller_registrar.cc
index 17daec5bac2376c6cf7ac0947f722701c862dfeb..e783e463fb2bbb6747c1978ff72857e1a8d3712d 100644
--- a/ash/mus/accelerators/accelerator_controller_registrar.cc
+++ b/ash/mus/accelerators/accelerator_controller_registrar.cc
@@ -11,9 +11,11 @@
#include "ash/common/wm_shell.h"
#include "ash/mus/accelerators/accelerator_ids.h"
#include "ash/mus/window_manager.h"
+#include "ash/public/interfaces/event_properties.mojom.h"
#include "ash/shell.h"
#include "base/logging.h"
#include "services/ui/common/accelerator_util.h"
+#include "services/ui/public/cpp/property_type_converters.h"
#include "ui/base/accelerators/accelerator_history.h"
namespace ash {
@@ -84,10 +86,17 @@ ui::mojom::EventResult AcceleratorControllerRegistrar::OnAccelerator(
if (!target_window)
target_window = Shell::GetWmRootWindowForNewWindows();
DCHECK(target_window);
- return router_->ProcessAccelerator(target_window, *(event.AsKeyEvent()),
- accelerator)
- ? ui::mojom::EventResult::HANDLED
- : ui::mojom::EventResult::UNHANDLED;
+ if (router_->ProcessAccelerator(target_window, *(event.AsKeyEvent()),
+ accelerator)) {
+ return ui::mojom::EventResult::HANDLED;
+ }
+ if (accelerator_controller->IsActionForAcceleratorEnabled(accelerator)) {
+ // We do have an accelerator for the key. Set a property so that the real
+ // target knows we have an accelerator.
+ (*properties)[mojom::kWillProcessAccelerator_KeyEventProperty] =
sky 2017/03/24 18:02:23 The |properties| supplied here are passed back to
sadrul 2017/03/24 18:05:01 Ooh, right. This is only for pre-target accelerato
sky 2017/03/24 18:11:54 Exactly. See line 75.
+ std::vector<uint8_t>();
+ }
+ return ui::mojom::EventResult::UNHANDLED;
}
DCHECK_EQ(GetAcceleratorLocalId(id), ids.post_id);
// NOTE: for post return value doesn't really matter.
« no previous file with comments | « ash/common/accelerators/accelerator_controller.cc ('k') | ash/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698