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

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

Issue 2520093003: WindowManagerClient::AddAccelerator() should take an array (Closed)
Patch Set: Modify helper to return vector and leverage helper in other files.Rename/format code. Created 4 years, 1 month 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 | « no previous file | services/ui/common/BUILD.gn » ('j') | services/ui/common/accelerator_transport_util.h » ('J')
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 79d7ea794ccaf9247c1c76c5187e4a1abfe8b742..c6ba5d827adb7313ff12130d509c595b907e9782 100644
--- a/ash/mus/accelerators/accelerator_controller_registrar.cc
+++ b/ash/mus/accelerators/accelerator_controller_registrar.cc
@@ -13,6 +13,7 @@
#include "ash/mus/bridge/wm_window_mus.h"
#include "ash/mus/window_manager.h"
#include "base/logging.h"
+#include "services/ui/common/accelerator_transport_util.h"
#include "services/ui/common/event_matcher_util.h"
#include "services/ui/public/cpp/window_manager_delegate.h"
#include "services/ui/public/cpp/window_tree_client.h"
@@ -126,12 +127,23 @@ void AcceleratorControllerRegistrar::OnAcceleratorRegistered(
post_event_matcher->accelerator_phase =
ui::mojom::AcceleratorPhase::POST_TARGET;
- window_manager_->window_manager_client()->AddAccelerator(
- ComputeAcceleratorId(id_namespace_, ids.pre_id), std::move(event_matcher),
- base::Bind(OnAcceleratorAdded, accelerator));
- window_manager_->window_manager_client()->AddAccelerator(
- ComputeAcceleratorId(id_namespace_, ids.post_id),
- std::move(post_event_matcher),
+ std::vector<ui::mojom::AcceleratorTransportPtr> pre_accelerators;
+ pre_accelerators =
+ AddAcceleratorHelper(std::move(pre_accelerators),
mfomitchev 2016/11/29 01:55:45 You are never passing a non-empty vector to AddAcc
thanhph 2016/11/29 16:50:17 Done, thanks! I use the first approach since the l
+ ComputeAcceleratorId(id_namespace_, ids.pre_id),
+ std::move(event_matcher));
+
+ window_manager_->window_manager_client()->AddAccelerators(
+ std::move(pre_accelerators), base::Bind(OnAcceleratorAdded, accelerator));
+
+ std::vector<ui::mojom::AcceleratorTransportPtr> post_accelerators;
+ post_accelerators =
+ AddAcceleratorHelper(std::move(post_accelerators),
+ ComputeAcceleratorId(id_namespace_, ids.post_id),
+ std::move(post_event_matcher));
+
+ window_manager_->window_manager_client()->AddAccelerators(
+ std::move(post_accelerators),
base::Bind(OnAcceleratorAdded, accelerator));
}
« no previous file with comments | « no previous file | services/ui/common/BUILD.gn » ('j') | services/ui/common/accelerator_transport_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698