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

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

Issue 272833002: View synchronization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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
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/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "mojo/public/cpp/bindings/callback.h" 12 #include "mojo/public/cpp/bindings/callback.h"
13 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" 13 #include "mojo/services/public/cpp/view_manager/view_tree_node.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 class Shell; 16 class Shell;
17 namespace services { 17 namespace services {
18 namespace view_manager { 18 namespace view_manager {
19 19
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 // Owns a synchronizer that keeps a client model in sync with the service. 25 // Owns a synchronizer that keeps a client model in sync with the service.
25 // Owned by the creator. 26 // Owned by the creator.
26 // 27 //
27 // TODO: displays 28 // TODO: displays
28 class ViewManager { 29 class ViewManager {
29 public: 30 public:
30 explicit ViewManager(Shell* shell); 31 explicit ViewManager(Shell* shell);
31 ~ViewManager(); 32 ~ViewManager();
32 33
33 // Connects to the View Manager service. This method must be called before 34 // Connects to the View Manager service. This method must be called before
34 // using any other View Manager lib class or function. 35 // using any other View Manager lib class or function.
35 // Blocks on establishing the connection and subsequently receiving a node 36 // Blocks on establishing the connection and subsequently receiving a node
36 // tree from the service. 37 // tree from the service.
37 // TODO(beng): blocking is currently achieved by running a nested runloop, 38 // TODO(beng): blocking is currently achieved by running a nested runloop,
38 // which will dispatch all messages on all pipes while blocking. 39 // which will dispatch all messages on all pipes while blocking.
39 // we should instead wait on the client pipe receiving a 40 // we should instead wait on the client pipe receiving a
40 // connection established message. 41 // connection established message.
41 // TODO(beng): this method could optionally not block if supplied a callback. 42 // TODO(beng): this method could optionally not block if supplied a callback.
42 void Init(); 43 void Init();
43 44
44 ViewTreeNode* tree() { return tree_; } 45 ViewTreeNode* tree() { return tree_; }
45 46
46 ViewTreeNode* GetNodeById(TransportNodeId id); 47 ViewTreeNode* GetNodeById(TransportNodeId id);
48 View* GetViewById(TransportViewId id);
47 49
48 private: 50 private:
49 friend class ViewManagerPrivate; 51 friend class ViewManagerPrivate;
50 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap; 52 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap;
53 typedef std::map<TransportViewId, View*> IdToViewMap;
51 54
52 Shell* shell_; 55 Shell* shell_;
53 scoped_ptr<ViewManagerSynchronizer> synchronizer_; 56 scoped_ptr<ViewManagerSynchronizer> synchronizer_;
54 ViewTreeNode* tree_; 57 ViewTreeNode* tree_;
55 58
56 IdToNodeMap nodes_; 59 IdToNodeMap nodes_;
60 IdToViewMap views_;
57 61
58 DISALLOW_COPY_AND_ASSIGN(ViewManager); 62 DISALLOW_COPY_AND_ASSIGN(ViewManager);
59 }; 63 };
60 64
61 } // namespace view_manager 65 } // namespace view_manager
62 } // namespace services 66 } // namespace services
63 } // namespace mojo 67 } // namespace mojo
64 68
65 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ 69 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/services/public/cpp/view_manager/view.h ('k') | mojo/services/public/cpp/view_manager/view_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698