Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / mojo / services / view_manager / ids.h
blob66efba39cb55f77207f6af5886cda7f52ecc7ccd
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
3 // found in the LICENSE file.
5 #ifndef MOJO_SERVICES_VIEW_MANAGER_IDS_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_IDS_H_
8 #include "mojo/services/public/cpp/view_manager/util.h"
9 #include "mojo/services/public/cpp/view_manager/view_manager_types.h"
10 #include "mojo/services/view_manager/view_manager_export.h"
12 namespace mojo {
13 namespace services {
14 namespace view_manager {
16 // Adds a bit of type safety to node ids.
17 struct MOJO_VIEW_MANAGER_EXPORT NodeId {
18 NodeId(TransportConnectionId connection_id,
19 TransportConnectionSpecificNodeId node_id)
20 : connection_id(connection_id),
21 node_id(node_id) {}
22 NodeId() : connection_id(0), node_id(0) {}
24 bool operator==(const NodeId& other) const {
25 return other.connection_id == connection_id &&
26 other.node_id == node_id;
29 bool operator!=(const NodeId& other) const {
30 return !(*this == other);
33 TransportConnectionId connection_id;
34 TransportConnectionSpecificNodeId node_id;
37 // Adds a bit of type safety to view ids.
38 struct MOJO_VIEW_MANAGER_EXPORT ViewId {
39 ViewId(TransportConnectionId connection_id,
40 TransportConnectionSpecificViewId view_id)
41 : connection_id(connection_id),
42 view_id(view_id) {}
43 ViewId() : connection_id(0), view_id(0) {}
45 bool operator==(const ViewId& other) const {
46 return other.connection_id == connection_id &&
47 other.view_id == view_id;
50 bool operator!=(const ViewId& other) const {
51 return !(*this == other);
54 TransportConnectionId connection_id;
55 TransportConnectionSpecificViewId view_id;
58 // Functions for converting to/from structs and transport values.
59 inline NodeId NodeIdFromTransportId(TransportNodeId id) {
60 return NodeId(HiWord(id), LoWord(id));
63 inline TransportNodeId NodeIdToTransportId(const NodeId& id) {
64 return (id.connection_id << 16) | id.node_id;
67 inline ViewId ViewIdFromTransportId(TransportViewId id) {
68 return ViewId(HiWord(id), LoWord(id));
71 inline TransportViewId ViewIdToTransportId(const ViewId& id) {
72 return (id.connection_id << 16) | id.view_id;
75 } // namespace view_manager
76 } // namespace services
77 } // namespace mojo
79 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_