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

Side by Side Diff: mojo/services/public/cpp/view_manager/view_manager.h

Issue 317433004: Get view manager client lib unit test harness to run again. Does not get any individual tests worki… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "mojo/public/cpp/bindings/callback.h" 13 #include "mojo/public/cpp/bindings/callback.h"
13 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" 14 #include "mojo/services/public/cpp/view_manager/view_tree_node.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 class Application; 17 class Application;
17 namespace view_manager { 18 namespace view_manager {
18 19
19 class View; 20 class View;
20 class ViewManagerSynchronizer; 21 class ViewManagerSynchronizer;
21 class ViewTreeNode; 22 class ViewTreeNode;
22 23
23 // Approximately encapsulates the View Manager service. 24 // Approximately encapsulates the View Manager service.
24 // Has a synchronizer that keeps a client model in sync with the service. 25 // Has a synchronizer that keeps a client model in sync with the service.
25 // Owned by the connection. 26 // Owned by the connection.
26 // 27 //
27 // TODO: displays 28 // TODO: displays
28 class ViewManager { 29 class ViewManager {
29 public: 30 public:
30 // Blocks on establishing the connection and subsequently receiving a node
31 // tree from the service.
32 // TODO(beng): blocking is currently achieved by running a nested runloop,
33 // which will dispatch all messages on all pipes while blocking.
34 // we should instead wait on the client pipe receiving a
35 // connection established message.
36 // TODO(beng): this method could optionally not block if supplied a callback.
37 explicit ViewManager(Application* application);
38 ~ViewManager(); 31 ~ViewManager();
39 32
33 // |ready_callback| is run when the ViewManager connection is established
34 // and ready to use.
35 static void Create(
36 Application* application,
37 const base::Callback<void(ViewManager*)> ready_callback);
38 // Blocks until ViewManager is ready to use.
39 static ViewManager* CreateBlocking(Application* application);
40
40 ViewTreeNode* tree() { return tree_; } 41 ViewTreeNode* tree() { return tree_; }
41 42
42 ViewTreeNode* GetNodeById(TransportNodeId id); 43 ViewTreeNode* GetNodeById(TransportNodeId id);
43 View* GetViewById(TransportViewId id); 44 View* GetViewById(TransportViewId id);
44 45
45 void Embed(const String& url, ViewTreeNode* node); 46 void Embed(const String& url, ViewTreeNode* node);
46 47
47 private: 48 private:
48 friend class ViewManagerPrivate; 49 friend class ViewManagerPrivate;
49 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap; 50 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap;
50 typedef std::map<TransportViewId, View*> IdToViewMap; 51 typedef std::map<TransportViewId, View*> IdToViewMap;
51 52
53 ViewManager(Application* application,
54 const base::Callback<void(ViewManager*)> ready_callback);
55
56 base::Callback<void(ViewManager*)> ready_callback_;
57
52 ViewManagerSynchronizer* synchronizer_; 58 ViewManagerSynchronizer* synchronizer_;
53 ViewTreeNode* tree_; 59 ViewTreeNode* tree_;
54 60
55 IdToNodeMap nodes_; 61 IdToNodeMap nodes_;
56 IdToViewMap views_; 62 IdToViewMap views_;
57 63
58 DISALLOW_COPY_AND_ASSIGN(ViewManager); 64 DISALLOW_COPY_AND_ASSIGN(ViewManager);
59 }; 65 };
60 66
61 } // namespace view_manager 67 } // namespace view_manager
62 } // namespace mojo 68 } // namespace mojo
63 69
64 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ 70 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698