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

Unified Diff: ash/mus/window_manager_application.cc

Issue 2171973003: Separates out accelerator handling in windowmanager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 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/mus/window_manager.cc ('k') | ash/mus/window_manager_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_application.cc
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index 00ddb0f9200b98975c733203649c196073949a8d..d1e831661255efb4c26be624a6837d20a2ed201f 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -7,7 +7,7 @@
#include <utility>
#include "ash/common/material_design/material_design_controller.h"
-#include "ash/mus/accelerator_registrar_impl.h"
+#include "ash/mus/accelerators/accelerator_registrar_impl.h"
#include "ash/mus/root_window_controller.h"
#include "ash/mus/shelf_layout_impl.h"
#include "ash/mus/user_window_controller_impl.h"
@@ -154,17 +154,15 @@ void WindowManagerApplication::Create(
if (!window_manager_->window_manager_client())
return; // Can happen during shutdown.
- static int accelerator_registrar_count = 0;
- if (accelerator_registrar_count == std::numeric_limits<int>::max()) {
- // Restart from zero if we have reached the limit. It is technically
- // possible to end up with multiple active registrars with the same
- // namespace, but it is highly unlikely. In the event that multiple
- // registrars have the same namespace, this new registrar will be unable to
- // install accelerators.
- accelerator_registrar_count = 0;
+ uint16_t accelerator_namespace_id;
+ if (!window_manager_->GetNextAcceleratorNamespaceId(
+ &accelerator_namespace_id)) {
+ DVLOG(1) << "Max number of accelerators registered, ignoring request.";
+ // All ids are used. Normally shouldn't happen, so we close the connection.
+ return;
}
accelerator_registrars_.insert(new AcceleratorRegistrarImpl(
- window_manager_.get(), ++accelerator_registrar_count, std::move(request),
+ window_manager_.get(), accelerator_namespace_id, std::move(request),
base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed,
base::Unretained(this))));
}
« no previous file with comments | « ash/mus/window_manager.cc ('k') | ash/mus/window_manager_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698