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

Unified Diff: chrome/browser/extensions/api/declarative/rule_identifier.cc

Issue 9315010: RulesRegistry for declarative APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 11 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: chrome/browser/extensions/api/declarative/rule_identifier.cc
diff --git a/chrome/browser/extensions/api/declarative/rule_identifier.cc b/chrome/browser/extensions/api/declarative/rule_identifier.cc
new file mode 100644
index 0000000000000000000000000000000000000000..05871accb986ee2bcbd0ab4c192ed6d4b2675006
--- /dev/null
+++ b/chrome/browser/extensions/api/declarative/rule_identifier.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 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 "chrome/browser/extensions/api/declarative/rule_identifier.h"
+
+namespace extensions {
+
+RuleIdentifier::RuleIdentifier(const std::string& extension_id,
+ const std::string& rule_id)
+ : extension_id_(extension_id),
+ rule_id_(rule_id) {}
+
+RuleIdentifier::RuleIdentifier(const RuleIdentifier& other)
+: extension_id_(other.extension_id_),
+ rule_id_(other.rule_id_) {}
+
+RuleIdentifier::~RuleIdentifier() {}
+
+bool RuleIdentifier::operator<(const RuleIdentifier& other) const {
+ // These are ordered so that the elements with most entropy are compared
+ // first.
+ if (rule_id_ < other.rule_id_) return true;
+ if (rule_id_ > other.rule_id_) return false;
+ if (extension_id_ < other.extension_id_) return true;
+ return false;
+}
+
+RuleIdentifier& RuleIdentifier::operator=(const RuleIdentifier& other) {
+ extension_id_ = other.extension_id_;
+ rule_id_ = other.rule_id_;
+ return *this;
+}
+
+} // extensions

Powered by Google App Engine
This is Rietveld 408576698