| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist
ry.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist
ry.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/declarative_content/content_action.h" | 7 #include "chrome/browser/extensions/api/declarative_content/content_action.h" |
| 8 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" | 8 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 std::string error; | 133 std::string error; |
| 134 RulesMap new_content_rules; | 134 RulesMap new_content_rules; |
| 135 | 135 |
| 136 for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator rule = | 136 for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator rule = |
| 137 rules.begin(); rule != rules.end(); ++rule) { | 137 rules.begin(); rule != rules.end(); ++rule) { |
| 138 ContentRule::GlobalRuleId rule_id(extension_id, *(*rule)->id); | 138 ContentRule::GlobalRuleId rule_id(extension_id, *(*rule)->id); |
| 139 DCHECK(content_rules_.find(rule_id) == content_rules_.end()); | 139 DCHECK(content_rules_.find(rule_id) == content_rules_.end()); |
| 140 | 140 |
| 141 scoped_ptr<ContentRule> content_rule( | 141 scoped_ptr<ContentRule> content_rule( |
| 142 ContentRule::Create(url_matcher_.condition_factory(), extension_id, | 142 ContentRule::Create(url_matcher_.condition_factory(), |
| 143 extension_installation_time, *rule, NULL, &error)); | 143 extension_id, |
| 144 extension_installation_time, |
| 145 *rule, |
| 146 ContentRule::ConsistencyChecker(), |
| 147 &error)); |
| 144 if (!error.empty()) { | 148 if (!error.empty()) { |
| 145 // Clean up temporary condition sets created during rule creation. | 149 // Clean up temporary condition sets created during rule creation. |
| 146 url_matcher_.ClearUnusedConditionSets(); | 150 url_matcher_.ClearUnusedConditionSets(); |
| 147 return error; | 151 return error; |
| 148 } | 152 } |
| 149 DCHECK(content_rule); | 153 DCHECK(content_rule); |
| 150 | 154 |
| 151 new_content_rules[rule_id] = make_linked_ptr(content_rule.release()); | 155 new_content_rules[rule_id] = make_linked_ptr(content_rule.release()); |
| 152 } | 156 } |
| 153 | 157 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 290 |
| 287 base::Time ContentRulesRegistry::GetExtensionInstallationTime( | 291 base::Time ContentRulesRegistry::GetExtensionInstallationTime( |
| 288 const std::string& extension_id) const { | 292 const std::string& extension_id) const { |
| 289 if (!extension_info_map_.get()) // May be NULL during testing. | 293 if (!extension_info_map_.get()) // May be NULL during testing. |
| 290 return base::Time(); | 294 return base::Time(); |
| 291 | 295 |
| 292 return extension_info_map_->GetInstallTime(extension_id); | 296 return extension_info_map_->GetInstallTime(extension_id); |
| 293 } | 297 } |
| 294 | 298 |
| 295 } // namespace extensions | 299 } // namespace extensions |
| OLD | NEW |