| 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_IDS_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_IDS_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_IDS_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_IDS_H_ |
| 7 | 7 |
| 8 #include "mojo/services/public/cpp/view_manager/types.h" | 8 #include "mojo/services/public/cpp/view_manager/types.h" |
| 9 #include "mojo/services/public/cpp/view_manager/util.h" | 9 #include "mojo/services/public/cpp/view_manager/util.h" |
| 10 #include "mojo/services/view_manager/view_manager_export.h" | 10 #include "mojo/services/view_manager/view_manager_export.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 namespace view_manager { | 13 namespace view_manager { |
| 14 namespace service { | 14 namespace service { |
| 15 | 15 |
| 16 // Connection id reserved for the root. | 16 // Connection id reserved for the root. |
| 17 const ConnectionSpecificId kRootConnection = 0; | 17 const ConnectionSpecificId kRootConnection = 0; |
| 18 | 18 |
| 19 // TODO(sky): remove this, temporary while window manager API is in existing |
| 20 // api. |
| 21 const ConnectionSpecificId kWindowManagerConnection = 1; |
| 22 |
| 19 // Adds a bit of type safety to node ids. | 23 // Adds a bit of type safety to node ids. |
| 20 struct MOJO_VIEW_MANAGER_EXPORT NodeId { | 24 struct MOJO_VIEW_MANAGER_EXPORT NodeId { |
| 21 NodeId(ConnectionSpecificId connection_id, ConnectionSpecificId node_id) | 25 NodeId(ConnectionSpecificId connection_id, ConnectionSpecificId node_id) |
| 22 : connection_id(connection_id), | 26 : connection_id(connection_id), |
| 23 node_id(node_id) {} | 27 node_id(node_id) {} |
| 24 NodeId() : connection_id(0), node_id(0) {} | 28 NodeId() : connection_id(0), node_id(0) {} |
| 25 | 29 |
| 26 bool operator==(const NodeId& other) const { | 30 bool operator==(const NodeId& other) const { |
| 27 return other.connection_id == connection_id && | 31 return other.connection_id == connection_id && |
| 28 other.node_id == node_id; | 32 other.node_id == node_id; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // ever be created with this id. | 85 // ever be created with this id. |
| 82 inline NodeId InvalidNodeId() { | 86 inline NodeId InvalidNodeId() { |
| 83 return NodeId(kRootConnection, 0); | 87 return NodeId(kRootConnection, 0); |
| 84 } | 88 } |
| 85 | 89 |
| 86 } // namespace service | 90 } // namespace service |
| 87 } // namespace view_manager | 91 } // namespace view_manager |
| 88 } // namespace mojo | 92 } // namespace mojo |
| 89 | 93 |
| 90 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_ | 94 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_ |
| OLD | NEW |