| 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/public/cpp/shell/service.h" |
| 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 14 #include "mojo/services/view_manager/ids.h" | 14 #include "mojo/services/view_manager/ids.h" |
| 15 #include "mojo/services/view_manager/node_delegate.h" | 15 #include "mojo/services/view_manager/node_delegate.h" |
| 16 #include "mojo/services/view_manager/view_manager_export.h" | 16 #include "mojo/services/view_manager/view_manager_export.h" |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 namespace services { | 19 namespace services { |
| 20 namespace view_manager { | 20 namespace view_manager { |
| 21 | 21 |
| 22 class Node; | 22 class Node; |
| 23 class RootNodeManager; | 23 class RootNodeManager; |
| 24 namespace service { |
| 24 class View; | 25 class View; |
| 26 } |
| 25 | 27 |
| 26 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 27 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu | 29 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu |
| 28 // below. | 30 // below. |
| 29 #pragma warning(push) | 31 #pragma warning(push) |
| 30 #pragma warning(disable : 4275) | 32 #pragma warning(disable : 4275) |
| 31 #endif | 33 #endif |
| 32 | 34 |
| 33 // Manages a connection from the client. | 35 // Manages a connection from the client. |
| 34 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection | 36 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection |
| 35 : public ServiceConnection<IViewManager, ViewManagerConnection, | 37 : public ServiceConnection<IViewManager, ViewManagerConnection, |
| 36 RootNodeManager>, | 38 RootNodeManager>, |
| 37 public NodeDelegate { | 39 public NodeDelegate { |
| 38 public: | 40 public: |
| 39 ViewManagerConnection(); | 41 ViewManagerConnection(); |
| 40 virtual ~ViewManagerConnection(); | 42 virtual ~ViewManagerConnection(); |
| 41 | 43 |
| 42 TransportConnectionId id() const { return id_; } | 44 TransportConnectionId id() const { return id_; } |
| 43 | 45 |
| 44 // Invoked when connection is established. | 46 // Invoked when connection is established. |
| 45 void Initialize(); | 47 void Initialize(); |
| 46 | 48 |
| 47 // Returns the Node with the specified id. | 49 // Returns the Node with the specified id. |
| 48 Node* GetNode(const NodeId& id); | 50 Node* GetNode(const NodeId& id); |
| 49 | 51 |
| 50 // Returns the View with the specified id. | 52 // Returns the View with the specified id. |
| 51 View* GetView(const ViewId& id); | 53 service::View* GetView(const ViewId& id); |
| 52 | 54 |
| 53 // Notifies the client of a hierarchy change. | 55 // Notifies the client of a hierarchy change. |
| 54 void NotifyNodeHierarchyChanged(const NodeId& node, | 56 void NotifyNodeHierarchyChanged(const NodeId& node, |
| 55 const NodeId& new_parent, | 57 const NodeId& new_parent, |
| 56 const NodeId& old_parent, | 58 const NodeId& old_parent, |
| 57 TransportChangeId server_change_id, | 59 TransportChangeId server_change_id, |
| 58 TransportChangeId client_change_id); | 60 TransportChangeId client_change_id); |
| 59 void NotifyNodeViewReplaced(const NodeId& node, | 61 void NotifyNodeViewReplaced(const NodeId& node, |
| 60 const ViewId& new_view_id, | 62 const ViewId& new_view_id, |
| 61 const ViewId& old_view_id, | 63 const ViewId& old_view_id, |
| 62 TransportChangeId client_change_id); | 64 TransportChangeId client_change_id); |
| 63 void NotifyNodeDeleted(const NodeId& node, | 65 void NotifyNodeDeleted(const NodeId& node, |
| 64 TransportChangeId server_change_id, | 66 TransportChangeId server_change_id, |
| 65 TransportChangeId client_change_id); | 67 TransportChangeId client_change_id); |
| 68 void NotifyViewDeleted(const ViewId& view, |
| 69 TransportChangeId server_change_id, |
| 70 TransportChangeId client_change_id); |
| 66 | 71 |
| 67 private: | 72 private: |
| 68 typedef std::map<TransportConnectionSpecificNodeId, Node*> NodeMap; | 73 typedef std::map<TransportConnectionSpecificNodeId, Node*> NodeMap; |
| 69 typedef std::map<TransportConnectionSpecificViewId, View*> ViewMap; | 74 typedef std::map<TransportConnectionSpecificViewId, service::View*> ViewMap; |
| 70 | 75 |
| 71 // Deletes a node owned by this connection. Returns true on success. |source| | 76 // Deletes a node owned by this connection. Returns true on success. |source| |
| 72 // is the connection that originated the change. | 77 // is the connection that originated the change. |
| 73 bool DeleteNodeImpl(ViewManagerConnection* source, | 78 bool DeleteNodeImpl(ViewManagerConnection* source, |
| 74 const NodeId& node_id, | 79 const NodeId& node_id, |
| 75 TransportChangeId change_id); | 80 TransportChangeId change_id); |
| 76 | 81 |
| 77 // Deletes a view owned by this connection. Returns true on success. |source| | 82 // Deletes a view owned by this connection. Returns true on success. |source| |
| 78 // is the connection that originated the change. | 83 // is the connection that originated the change. |
| 79 bool DeleteViewImpl(ViewManagerConnection* source, | 84 bool DeleteViewImpl(ViewManagerConnection* source, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 143 |
| 139 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
| 140 #pragma warning(pop) | 145 #pragma warning(pop) |
| 141 #endif | 146 #endif |
| 142 | 147 |
| 143 } // namespace view_manager | 148 } // namespace view_manager |
| 144 } // namespace services | 149 } // namespace services |
| 145 } // namespace mojo | 150 } // namespace mojo |
| 146 | 151 |
| 147 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ | 152 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ |
| OLD | NEW |