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