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

Side by Side 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: Implemented ID and priority generation Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698