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