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

Side by Side Diff: mojo/services/view_manager/view_manager_connection.h

Issue 284113009: Mojo: Internalize ServiceConnector<> (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_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "mojo/public/cpp/shell/service.h"
13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" 12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
14 #include "mojo/services/view_manager/ids.h" 13 #include "mojo/services/view_manager/ids.h"
15 #include "mojo/services/view_manager/node_delegate.h" 14 #include "mojo/services/view_manager/node_delegate.h"
16 #include "mojo/services/view_manager/view_manager_export.h" 15 #include "mojo/services/view_manager/view_manager_export.h"
17 16
18 namespace mojo { 17 namespace mojo {
19 namespace view_manager { 18 namespace view_manager {
20 namespace service { 19 namespace service {
21 20
22 class Node; 21 class Node;
23 class RootNodeManager; 22 class RootNodeManager;
24 class View; 23 class View;
25 24
26 #if defined(OS_WIN) 25 #if defined(OS_WIN)
27 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu 26 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu
28 // below. 27 // below.
29 #pragma warning(push) 28 #pragma warning(push)
30 #pragma warning(disable : 4275) 29 #pragma warning(disable : 4275)
31 #endif 30 #endif
32 31
33 // Manages a connection from the client. 32 // Manages a connection from the client.
34 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection 33 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection
35 : public ServiceConnection<IViewManager, ViewManagerConnection, 34 : public InterfaceImpl<IViewManager>,
36 RootNodeManager>,
37 public NodeDelegate { 35 public NodeDelegate {
38 public: 36 public:
39 ViewManagerConnection(); 37 ViewManagerConnection(RootNodeManager* root_node_manager);
40 virtual ~ViewManagerConnection(); 38 virtual ~ViewManagerConnection();
41 39
40 virtual void OnConnectionEstablished() MOJO_OVERRIDE;
41 virtual void OnConnectionError() MOJO_OVERRIDE;
42
42 TransportConnectionId id() const { return id_; } 43 TransportConnectionId id() const { return id_; }
43 44
44 // Invoked when connection is established.
45 void Initialize();
46
47 // Returns the Node with the specified id. 45 // Returns the Node with the specified id.
48 Node* GetNode(const NodeId& id); 46 Node* GetNode(const NodeId& id);
49 47
50 // Returns the View with the specified id. 48 // Returns the View with the specified id.
51 View* GetView(const ViewId& id); 49 View* GetView(const ViewId& id);
52 50
53 // Notifies the client of a hierarchy change. 51 // Notifies the client of a hierarchy change.
54 void NotifyNodeHierarchyChanged(const NodeId& node, 52 void NotifyNodeHierarchyChanged(const NodeId& node,
55 const NodeId& new_parent, 53 const NodeId& new_parent,
56 const NodeId& old_parent, 54 const NodeId& old_parent,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ScopedSharedBufferHandle buffer, 102 ScopedSharedBufferHandle buffer,
105 uint32_t buffer_size) OVERRIDE; 103 uint32_t buffer_size) OVERRIDE;
106 104
107 // Overridden from NodeDelegate: 105 // Overridden from NodeDelegate:
108 virtual void OnNodeHierarchyChanged(const NodeId& node, 106 virtual void OnNodeHierarchyChanged(const NodeId& node,
109 const NodeId& new_parent, 107 const NodeId& new_parent,
110 const NodeId& old_parent) OVERRIDE; 108 const NodeId& old_parent) OVERRIDE;
111 virtual void OnNodeViewReplaced(const NodeId& node, 109 virtual void OnNodeViewReplaced(const NodeId& node,
112 const ViewId& new_view_id, 110 const ViewId& new_view_id,
113 const ViewId& old_view_id) OVERRIDE; 111 const ViewId& old_view_id) OVERRIDE;
112 RootNodeManager* root_node_manager_;
114 113
115 // Id of this connection as assigned by RootNodeManager. Assigned in 114 // Id of this connection as assigned by RootNodeManager. Assigned in
116 // Initialize(). 115 // OnConnectionEstablished().
117 TransportConnectionId id_; 116 TransportConnectionId id_;
118 117
119 NodeMap node_map_; 118 NodeMap node_map_;
120 119
121 ViewMap view_map_; 120 ViewMap view_map_;
122 121
123 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); 122 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection);
124 }; 123 };
125 124
126 #if defined(OS_WIN) 125 #if defined(OS_WIN)
127 #pragma warning(pop) 126 #pragma warning(pop)
128 #endif 127 #endif
129 128
130 } // namespace service 129 } // namespace service
131 } // namespace view_manager 130 } // namespace view_manager
132 } // namespace mojo 131 } // namespace mojo
133 132
134 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ 133 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/root_view_manager.cc ('k') | mojo/services/view_manager/view_manager_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698