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

Unified Diff: services/ui/common/accelerator_util.cc

Issue 2520093003: WindowManagerClient::AddAccelerator() should take an array (Closed)
Patch Set: Use std::move instead of Clone() Created 4 years 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 | « services/ui/common/accelerator_util.h ('k') | services/ui/common/event_matcher_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/common/accelerator_util.cc
diff --git a/services/ui/common/event_matcher_util.cc b/services/ui/common/accelerator_util.cc
similarity index 61%
rename from services/ui/common/event_matcher_util.cc
rename to services/ui/common/accelerator_util.cc
index 64028b393c3b5b3eca7b5731305d4a512ee12142..11dca3f22cc281f795010a734b6899bab1eb7fd7 100644
--- a/services/ui/common/event_matcher_util.cc
+++ b/services/ui/common/accelerator_util.cc
@@ -1,8 +1,8 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 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 "services/ui/common/event_matcher_util.h"
+#include "services/ui/common/accelerator_util.h"
namespace ui {
@@ -18,11 +18,27 @@ mojom::EventMatcherPtr CreateKeyMatcher(ui::mojom::KeyboardCode code,
ui::mojom::kEventFlagScrollLockOn |
ui::mojom::kEventFlagNumLockOn;
matcher->key_matcher = mojom::KeyEventMatcher::New();
-
matcher->type_matcher->type = ui::mojom::EventType::KEY_PRESSED;
matcher->flags_matcher->flags = flags;
matcher->key_matcher->keyboard_code = code;
return matcher;
}
+std::vector<ui::mojom::AcceleratorPtr> CreateAcceleratorVector(
+ uint32_t id,
+ ui::mojom::EventMatcherPtr event_matcher) {
+ std::vector<ui::mojom::AcceleratorPtr> accelerators;
+ accelerators.push_back(CreateAccelerator(id, std::move(event_matcher)));
+ return accelerators;
+}
+
+ui::mojom::AcceleratorPtr CreateAccelerator(
+ uint32_t id,
+ ui::mojom::EventMatcherPtr event_matcher) {
+ ui::mojom::AcceleratorPtr accelerator_ptr = ui::mojom::Accelerator::New();
+ accelerator_ptr->id = id;
+ accelerator_ptr->event_matcher = std::move(event_matcher);
+ return accelerator_ptr;
+}
+
} // namespace ui
« no previous file with comments | « services/ui/common/accelerator_util.h ('k') | services/ui/common/event_matcher_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698