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

Unified Diff: components/mus/ws/window_manager_factory_registry.cc

Issue 1755223002: Adds WindowManagerManager to mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and WindowManagerState Created 4 years, 10 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
Index: components/mus/ws/window_manager_factory_registry.cc
diff --git a/components/mus/ws/window_manager_factory_registry.cc b/components/mus/ws/window_manager_factory_registry.cc
new file mode 100644
index 0000000000000000000000000000000000000000..98cc53b0ed0b61909a1004acd89c2f22a8c4b25d
--- /dev/null
+++ b/components/mus/ws/window_manager_factory_registry.cc
@@ -0,0 +1,58 @@
+// 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 "components/mus/ws/window_manager_factory_registry.h"
+
+#include "components/mus/ws/connection_manager.h"
+#include "components/mus/ws/window_manager_factory_service.h"
+
+namespace mus {
+namespace ws {
+
+WindowManagerFactoryRegistry::WindowManagerFactoryRegistry(
+ ConnectionManager* connection_manager)
+ : connection_manager_(connection_manager) {}
+
+WindowManagerFactoryRegistry::~WindowManagerFactoryRegistry() {}
+
+void WindowManagerFactoryRegistry::Register(
+ uint32_t user_id,
+ mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) {
+ for (auto& service_ptr : services_) {
+ if (service_ptr->user_id() == user_id) {
+ LOG(ERROR) << "WindowManagerFactoryService already registered for "
+ << user_id;
+ return;
+ }
+ }
+
+ scoped_ptr<WindowManagerFactoryService> service(
+ new WindowManagerFactoryService(this, user_id, std::move(request)));
+ services_.push_back(std::move(service));
+}
+
+std::vector<WindowManagerFactoryService*>
+WindowManagerFactoryRegistry::GetServices() {
+ std::vector<WindowManagerFactoryService*> result;
+ for (auto& service_ptr : services_)
+ result.push_back(service_ptr.get());
+ return result;
+}
+
+void WindowManagerFactoryRegistry::OnWindowManagerFactoryConnectionLost(
+ WindowManagerFactoryService* service) {
+ for (auto it = services_.begin(); it != services_.end(); ++it) {
+ if (it->get() == service) {
+ services_.erase(it);
+ return;
+ }
+ }
+}
+
+void WindowManagerFactoryRegistry::OnWindowManagerFactorySet() {
+ connection_manager_->OnWindowManagerFactorySet();
+}
+
+} // namespace ws
+} // namespace mus
« no previous file with comments | « components/mus/ws/window_manager_factory_registry.h ('k') | components/mus/ws/window_manager_factory_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698