| 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 | 11 |
| 11 namespace mojo { | 12 namespace mojo { |
| 12 namespace service { | 13 namespace service { |
| 13 | 14 |
| 14 // Connection id is used to indicate no connection. That is, no | 15 // Connection id is used to indicate no connection. That is, no |
| 15 // ViewManagerServiceImpl ever gets this id. | 16 // ViewManagerServiceImpl ever gets this id. |
| 16 const ConnectionSpecificId kInvalidConnectionId = 0; | 17 const ConnectionSpecificId kInvalidConnectionId = 0; |
| 17 | 18 |
| 18 // TODO(sky): remove this, temporary while window manager API is in existing | 19 // TODO(sky): remove this, temporary while window manager API is in existing |
| 19 // api. | 20 // api. |
| 20 const ConnectionSpecificId kWindowManagerConnection = 1; | 21 const ConnectionSpecificId kWindowManagerConnection = 1; |
| 21 | 22 |
| 22 // Adds a bit of type safety to view ids. | 23 // Adds a bit of type safety to view ids. |
| 23 struct ViewId { | 24 struct MOJO_VIEW_MANAGER_EXPORT ViewId { |
| 24 ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id) | 25 ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id) |
| 25 : connection_id(connection_id), | 26 : connection_id(connection_id), |
| 26 view_id(view_id) {} | 27 view_id(view_id) {} |
| 27 ViewId() : connection_id(0), view_id(0) {} | 28 ViewId() : connection_id(0), view_id(0) {} |
| 28 | 29 |
| 29 bool operator==(const ViewId& other) const { | 30 bool operator==(const ViewId& other) const { |
| 30 return other.connection_id == connection_id && | 31 return other.connection_id == connection_id && |
| 31 other.view_id == view_id; | 32 other.view_id == view_id; |
| 32 } | 33 } |
| 33 | 34 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 // Returns a ViewId that is reserved to indicate no view. That is, no view will | 55 // Returns a ViewId that is reserved to indicate no view. That is, no view will |
| 55 // ever be created with this id. | 56 // ever be created with this id. |
| 56 inline ViewId InvalidViewId() { | 57 inline ViewId InvalidViewId() { |
| 57 return ViewId(kInvalidConnectionId, 0); | 58 return ViewId(kInvalidConnectionId, 0); |
| 58 } | 59 } |
| 59 | 60 |
| 60 } // namespace service | 61 } // namespace service |
| 61 } // namespace mojo | 62 } // namespace mojo |
| 62 | 63 |
| 63 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_ | 64 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_ |
| OLD | NEW |