Index: extensions/common/host_id.h |
diff --git a/extensions/common/host_id.h b/extensions/common/host_id.h |
index 004480704f07766662006c7c3c570883c7e9a296..e30ea0047e1082646b4a1406b1a67dca9dd19649 100644 |
--- a/extensions/common/host_id.h |
+++ b/extensions/common/host_id.h |
@@ -7,14 +7,24 @@ |
#include <string> |
+#include "base/macros.h" |
Devlin
2015/02/10 20:59:53
Cleanup.
Xi Han
2015/02/10 23:35:14
Done.
|
+ |
// IDs of hosts who own user scripts. |
// A HostID is immutable after creation. |
struct HostID { |
enum HostType { EXTENSIONS, WEBUI }; |
+ // The default id of the instance that host will inject the script. |
+ // If the instance is a regular tab, the |instance_id| is 0; if the instance |
+ // is <webview>, the |instance_id| is a unique number that is bigger than 0. |
+ static const int kDefaultInstanceId; |
+ |
HostID() {} |
HostID(HostType type, const std::string& id) |
: type_(type), id_(id) {} |
+ HostID(const HostID& host_id) |
+ : type_(host_id.type()), |
+ id_(host_id.id()) {} |
bool operator<(const HostID& host_id) const { |
if (type_ != host_id.type()) |
@@ -24,6 +34,10 @@ struct HostID { |
return false; |
} |
+ bool operator==(const HostID& host_id) const { |
+ return type_ == host_id.type() && id_ == host_id.id(); |
+ } |
+ |
HostType type() const { return type_; } |
const std::string& id() const { return id_; } |