summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/declarative
diff options
context:
space:
mode:
authorvabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-19 22:04:58 +0000
committervabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-19 22:04:58 +0000
commit6b77f54e2e056a4597b1b6f750c16a3203b714a3 (patch)
treee3c9b2bface9464d0ec6c115d2753aff6193e51d /chrome/browser/extensions/api/declarative
parent5c18edd1e908be3be47071c3a76ace1365ccb167 (diff)
downloadchromium_src-6b77f54e2e056a4597b1b6f750c16a3203b714a3.zip
chromium_src-6b77f54e2e056a4597b1b6f750c16a3203b714a3.tar.gz
chromium_src-6b77f54e2e056a4597b1b6f750c16a3203b714a3.tar.bz2
Clean-up in RulesRegistry
A very simple clean-up I noticed needing done when working on some fix in RulesRegistry: 1. DCHECK -> DCHECK_EQ 2. Remove redundant "RulesRegistry::" in rules_registry.cc BUG=313241 Review URL: https://codereview.chromium.org/76013003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/declarative')
-rw-r--r--chrome/browser/extensions/api/declarative/rules_cache_delegate.cc2
-rw-r--r--chrome/browser/extensions/api/declarative/rules_registry.cc29
2 files changed, 16 insertions, 15 deletions
diff --git a/chrome/browser/extensions/api/declarative/rules_cache_delegate.cc b/chrome/browser/extensions/api/declarative/rules_cache_delegate.cc
index 6254a41..d2a45fb 100644
--- a/chrome/browser/extensions/api/declarative/rules_cache_delegate.cc
+++ b/chrome/browser/extensions/api/declarative/rules_cache_delegate.cc
@@ -119,7 +119,7 @@ void RulesCacheDelegate::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED);
+ DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_LOADED, type);
const extensions::Extension* extension =
content::Details<const extensions::Extension>(details).ptr();
diff --git a/chrome/browser/extensions/api/declarative/rules_registry.cc b/chrome/browser/extensions/api/declarative/rules_registry.cc
index c994963..5b5bbc4 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry.cc
@@ -188,7 +188,7 @@ std::string RulesRegistry::RemoveAllRules(const std::string& extension_id) {
std::string RulesRegistry::GetRules(
const std::string& extension_id,
const std::vector<std::string>& rule_identifiers,
- std::vector<linked_ptr<RulesRegistry::Rule> >* out) {
+ std::vector<linked_ptr<Rule> >* out) {
DCHECK(content::BrowserThread::CurrentlyOn(owner_thread()));
for (std::vector<std::string>::const_iterator i = rule_identifiers.begin();
@@ -201,9 +201,8 @@ std::string RulesRegistry::GetRules(
return kSuccess;
}
-std::string RulesRegistry::GetAllRules(
- const std::string& extension_id,
- std::vector<linked_ptr<RulesRegistry::Rule> >* out) {
+std::string RulesRegistry::GetAllRules(const std::string& extension_id,
+ std::vector<linked_ptr<Rule> >* out) {
DCHECK(content::BrowserThread::CurrentlyOn(owner_thread()));
for (RulesDictionary::const_iterator i = rules_.begin();
@@ -263,7 +262,7 @@ void RulesRegistry::ProcessChangedRules(const std::string& extension_id) {
process_changed_rules_requested_ = NOT_SCHEDULED_FOR_PROCESSING;
- std::vector<linked_ptr<RulesRegistry::Rule> > new_rules;
+ std::vector<linked_ptr<Rule> > new_rules;
std::string error = GetAllRules(extension_id, &new_rules);
DCHECK_EQ(std::string(), error);
content::BrowserThread::PostTask(
@@ -303,15 +302,16 @@ std::string RulesRegistry::GenerateUniqueId(const std::string& extension_id) {
std::string RulesRegistry::CheckAndFillInOptionalRules(
const std::string& extension_id,
- const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) {
+ const std::vector<linked_ptr<Rule> >& rules) {
// IDs we have inserted, in case we need to rollback this operation.
std::vector<std::string> rollback_log;
// First we insert all rules with existing identifier, so that generated
// identifiers cannot collide with identifiers passed by the caller.
- for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator i =
- rules.begin(); i != rules.end(); ++i) {
- RulesRegistry::Rule* rule = i->get();
+ for (std::vector<linked_ptr<Rule> >::const_iterator i = rules.begin();
+ i != rules.end();
+ ++i) {
+ Rule* rule = i->get();
if (rule->id.get()) {
std::string id = *(rule->id);
if (!IsUniqueId(extension_id, id)) {
@@ -323,9 +323,10 @@ std::string RulesRegistry::CheckAndFillInOptionalRules(
}
// Now we generate IDs in case they were not specified in the rules. This
// cannot fail so we do not need to keep track of a rollback log.
- for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator i =
- rules.begin(); i != rules.end(); ++i) {
- RulesRegistry::Rule* rule = i->get();
+ for (std::vector<linked_ptr<Rule> >::const_iterator i = rules.begin();
+ i != rules.end();
+ ++i) {
+ Rule* rule = i->get();
if (!rule->id.get()) {
rule->id.reset(new std::string(GenerateUniqueId(extension_id)));
used_rule_identifiers_[extension_id].insert(*(rule->id));
@@ -335,8 +336,8 @@ std::string RulesRegistry::CheckAndFillInOptionalRules(
}
void RulesRegistry::FillInOptionalPriorities(
- const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) {
- std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator i;
+ const std::vector<linked_ptr<Rule> >& rules) {
+ std::vector<linked_ptr<Rule> >::const_iterator i;
for (i = rules.begin(); i != rules.end(); ++i) {
if (!(*i)->priority.get())
(*i)->priority.reset(new int(DEFAULT_PRIORITY));