Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/api/declarative/rule_identifier.h" | |
| 6 | |
| 7 namespace extensions { | |
| 8 | |
| 9 RuleIdentifier::RuleIdentifier(const std::string& extension_id, | |
|
Aaron Boodman
2012/02/02 16:28:51
unit test?
battre
2012/02/06 16:21:04
Done.
| |
| 10 const std::string& event_name, | |
| 11 const std::string& rule_id) | |
| 12 : extension_id_(extension_id), | |
| 13 event_name_(event_name), | |
| 14 rule_id_(rule_id) {} | |
| 15 | |
| 16 RuleIdentifier::RuleIdentifier(const RuleIdentifier& other) | |
| 17 : extension_id_(other.extension_id_), | |
| 18 event_name_(other.event_name_), | |
| 19 rule_id_(other.rule_id_) {} | |
| 20 | |
| 21 RuleIdentifier::~RuleIdentifier() {} | |
| 22 | |
| 23 bool RuleIdentifier::operator<(const RuleIdentifier& other) const { | |
| 24 // These are ordered so that the elements with most entropy are compared | |
| 25 // first. | |
| 26 if (rule_id_ < other.rule_id_) return true; | |
| 27 if (rule_id_ > other.rule_id_) return false; | |
| 28 if (event_name_ < other.event_name_) return true; | |
| 29 if (event_name_ > other.event_name_) return false; | |
| 30 if (extension_id_ < other.extension_id_) return true; | |
| 31 return false; | |
| 32 } | |
| 33 | |
| 34 RuleIdentifier& RuleIdentifier::operator=(const RuleIdentifier& other) { | |
| 35 extension_id_ = other.extension_id_; | |
| 36 event_name_ = other.event_name_; | |
| 37 rule_id_ = other.rule_id_; | |
| 38 return *this; | |
| 39 } | |
| 40 | |
| 41 } // extensions | |
| OLD | NEW |