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

Unified Diff: services/ui/view_manager/view_associate_table.h

Issue 1552043002: Make Mozart view manager use the new compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-12
Patch Set: Created 4 years, 12 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: services/ui/view_manager/view_associate_table.h
diff --git a/services/ui/view_manager/view_associate_table.h b/services/ui/view_manager/view_associate_table.h
new file mode 100644
index 0000000000000000000000000000000000000000..9cdc71b84eb78910e3eadde605baca78a690c6ae
--- /dev/null
+++ b/services/ui/view_manager/view_associate_table.h
@@ -0,0 +1,71 @@
+// Copyright 2015 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.
+
+#ifndef SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_
+#define SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "mojo/common/binding_set.h"
+#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/services/ui/views/interfaces/view_associates.mojom.h"
+
+namespace view_manager {
+
+// Maintains a table of all connected view associates.
+class ViewAssociateTable {
+ public:
+ using AssociateConnectionErrorCallback =
+ base::Callback<void(const std::string&)>;
+
+ ViewAssociateTable();
+ ~ViewAssociateTable();
+
+ // Begins connecting to the view associates.
+ // Invokes |connection_error_callback| if an associate connection fails
+ // and provides the associate's url.
+ void ConnectAssociates(
+ mojo::ApplicationImpl* app_impl,
+ mojo::ui::ViewInspector* inspector,
+ const std::vector<std::string>& urls,
+ const AssociateConnectionErrorCallback& connection_error_callback);
+
+ // Connects to services offered by the view associates.
+ void ConnectToViewService(mojo::ui::ViewTokenPtr view_token,
+ const mojo::String& service_name,
+ mojo::ScopedMessagePipeHandle client_handle);
+ void ConnectToViewTreeService(mojo::ui::ViewTreeTokenPtr view_tree_token,
+ const mojo::String& service_name,
+ mojo::ScopedMessagePipeHandle client_handle);
+
+ void OnConnected(uint32_t index, mojo::ui::ViewAssociateInfoPtr info);
+
+ void CompleteDeferredWork();
+
+ private:
+ struct AssociateData {
+ AssociateData(const std::string& url, mojo::ui::ViewInspector* inspector);
+ ~AssociateData();
+
+ const std::string url;
+ mojo::ui::ViewAssociatePtr associate;
+ mojo::ui::ViewAssociateInfoPtr info;
+ mojo::Binding<mojo::ui::ViewInspector> inspector_binding;
+ };
+
+ std::vector<std::unique_ptr<AssociateData>> associates_;
+
+ uint32_t pending_connection_count_ = 0u;
+ std::vector<base::Closure> deferred_work_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewAssociateTable);
+};
+
+} // namespace view_manager
+
+#endif // SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_

Powered by Google App Engine
This is Rietveld 408576698