summaryrefslogtreecommitdiffstats
path: root/extensions/common/host_id.cc
diff options
context:
space:
mode:
authorhanxi <hanxi@chromium.org>2015-02-13 12:51:58 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-13 20:52:47 +0000
commita5c856cf3ea4f69aa00c6c24676e0bca3f05962a (patch)
tree6ff2b71aa632315a5d2df7f96b54b7303543e934 /extensions/common/host_id.cc
parenta3d81701bb7d2c162ccf85529d602ed3e4a0a258 (diff)
downloadchromium_src-a5c856cf3ea4f69aa00c6c24676e0bca3f05962a.zip
chromium_src-a5c856cf3ea4f69aa00c6c24676e0bca3f05962a.tar.gz
chromium_src-a5c856cf3ea4f69aa00c6c24676e0bca3f05962a.tar.bz2
A refacotring in the renderer side: introduce InjectionHost to de-couple extensions and to support content script injection out of chrome extensions.
BUG=437566 Review URL: https://codereview.chromium.org/885493007 Cr-Commit-Position: refs/heads/master@{#316283}
Diffstat (limited to 'extensions/common/host_id.cc')
-rw-r--r--extensions/common/host_id.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/extensions/common/host_id.cc b/extensions/common/host_id.cc
new file mode 100644
index 0000000..121e8e4
--- /dev/null
+++ b/extensions/common/host_id.cc
@@ -0,0 +1,32 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/common/host_id.h"
+
+HostID::HostID() {
+}
+
+HostID::HostID(HostType type, const std::string& id)
+ : type_(type), id_(id) {
+}
+
+HostID::HostID(const HostID& host_id)
+ : type_(host_id.type()),
+ id_(host_id.id()) {
+}
+
+HostID::~HostID() {
+}
+
+bool HostID::operator<(const HostID& host_id) const {
+ if (type_ != host_id.type())
+ return type_ < host_id.type();
+ else if (id_ != host_id.id())
+ return id_ < host_id.id();
+ return false;
+}
+
+bool HostID::operator==(const HostID& host_id) const {
+ return type_ == host_id.type() && id_ == host_id.id();
+}