Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: extensions/common/host_id.h

Issue 885493007: Refactoring: de-couple Extensions from "script injection System" [render side] : 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/common/host_id.h
diff --git a/extensions/common/host_id.h b/extensions/common/host_id.h
index 004480704f07766662006c7c3c570883c7e9a296..4f6240a70867be95464a3fdb2edfde4839200929 100644
--- a/extensions/common/host_id.h
+++ b/extensions/common/host_id.h
@@ -12,9 +12,17 @@
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) {}
Devlin 2015/02/11 00:00:48 Since we need a .cc for the definition of kDefault
Xi Han 2015/02/11 16:00:23 Moved.
+ 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 +32,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_; }

Powered by Google App Engine
This is Rietveld 408576698