Index: extensions/common/host_id.h |
diff --git a/extensions/common/host_id.h b/extensions/common/host_id.h |
index 004480704f07766662006c7c3c570883c7e9a296..7efd64d67559c158ac2133dd3ed4797146fd8e17 100644 |
--- a/extensions/common/host_id.h |
+++ b/extensions/common/host_id.h |
@@ -7,6 +7,8 @@ |
#include <string> |
+#include "base/macros.h" |
+ |
// IDs of hosts who own user scripts. |
// A HostID is immutable after creation. |
struct HostID { |
@@ -15,6 +17,9 @@ struct HostID { |
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()) |
@@ -36,4 +41,24 @@ struct HostID { |
std::string id_; |
}; |
+// An interface for all kinds of hosts who own user scripts. |
Devlin
2015/02/04 17:01:14
nit: extra space between "of" and "hosts"
Xi Han
2015/02/05 16:06:20
Done.
|
+class Host { |
+ public: |
+ // 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; |
+ |
+ Host(const HostID& host_id); |
+ virtual ~Host(); |
+ |
+ const HostID& id() const { return id_; } |
+ private: |
+ // The ID of the host. |
+ HostID id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(Host); |
+}; |
+ |
#endif // EXTENSIONS_COMMON_HOST_ID_H_ |