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

Side by Side 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, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_
6 #define SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "base/macros.h"
14 #include "mojo/common/binding_set.h"
15 #include "mojo/public/cpp/application/application_impl.h"
16 #include "mojo/services/ui/views/interfaces/view_associates.mojom.h"
17
18 namespace view_manager {
19
20 // Maintains a table of all connected view associates.
21 class ViewAssociateTable {
22 public:
23 using AssociateConnectionErrorCallback =
24 base::Callback<void(const std::string&)>;
25
26 ViewAssociateTable();
27 ~ViewAssociateTable();
28
29 // Begins connecting to the view associates.
30 // Invokes |connection_error_callback| if an associate connection fails
31 // and provides the associate's url.
32 void ConnectAssociates(
33 mojo::ApplicationImpl* app_impl,
34 mojo::ui::ViewInspector* inspector,
35 const std::vector<std::string>& urls,
36 const AssociateConnectionErrorCallback& connection_error_callback);
37
38 // Connects to services offered by the view associates.
39 void ConnectToViewService(mojo::ui::ViewTokenPtr view_token,
40 const mojo::String& service_name,
41 mojo::ScopedMessagePipeHandle client_handle);
42 void ConnectToViewTreeService(mojo::ui::ViewTreeTokenPtr view_tree_token,
43 const mojo::String& service_name,
44 mojo::ScopedMessagePipeHandle client_handle);
45
46 void OnConnected(uint32_t index, mojo::ui::ViewAssociateInfoPtr info);
47
48 void CompleteDeferredWork();
49
50 private:
51 struct AssociateData {
52 AssociateData(const std::string& url, mojo::ui::ViewInspector* inspector);
53 ~AssociateData();
54
55 const std::string url;
56 mojo::ui::ViewAssociatePtr associate;
57 mojo::ui::ViewAssociateInfoPtr info;
58 mojo::Binding<mojo::ui::ViewInspector> inspector_binding;
59 };
60
61 std::vector<std::unique_ptr<AssociateData>> associates_;
62
63 uint32_t pending_connection_count_ = 0u;
64 std::vector<base::Closure> deferred_work_;
65
66 DISALLOW_COPY_AND_ASSIGN(ViewAssociateTable);
67 };
68
69 } // namespace view_manager
70
71 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698