1 // Copyright 2015 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 EXTENSIONS_COMMON_HOST_ID_H_
6 #define EXTENSIONS_COMMON_HOST_ID_H_
10 // IDs of hosts who own user scripts.
11 // A HostID is immutable after creation.
13 enum HostType
{ EXTENSIONS
, WEBUI
};
16 HostID(HostType type
, const std::string
& id
)
17 : type_(type
), id_(id
) {}
19 bool operator<(const HostID
& host_id
) const {
20 if (type_
!= host_id
.type())
21 return type_
< host_id
.type();
22 else if (id_
!= host_id
.id())
23 return id_
< host_id
.id();
27 HostType
type() const { return type_
; }
28 const std::string
& id() const { return id_
; }
31 // The type of the host.
34 // Similar to extension_id, host_id is a unique indentifier for a host,
35 // e.g., an Extension or WebUI.
39 #endif // EXTENSIONS_COMMON_HOST_ID_H_