| 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/chrome_content_rules
_registry.h" | 5 #include "chrome/browser/extensions/api/declarative_content/chrome_content_rules
_registry.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/api/declarative_content/content_action.h" | 8 #include "chrome/browser/extensions/api/declarative_content/content_action.h" |
| 9 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" | 9 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" |
| 10 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" | 10 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator rule = | 162 for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator rule = |
| 163 rules.begin(); | 163 rules.begin(); |
| 164 rule != rules.end(); | 164 rule != rules.end(); |
| 165 ++rule) { | 165 ++rule) { |
| 166 ContentRule::GlobalRuleId rule_id(extension_id, *(*rule)->id); | 166 ContentRule::GlobalRuleId rule_id(extension_id, *(*rule)->id); |
| 167 DCHECK(content_rules_.find(rule_id) == content_rules_.end()); | 167 DCHECK(content_rules_.find(rule_id) == content_rules_.end()); |
| 168 | 168 |
| 169 scoped_ptr<ContentRule> content_rule( | 169 scoped_ptr<ContentRule> content_rule( |
| 170 ContentRule::Create(url_matcher_.condition_factory(), browser_context(), | 170 ContentRule::Create(url_matcher_.condition_factory(), browser_context(), |
| 171 HostID(HostID::EXTENSIONS, extension->id()), |
| 171 extension, extension_installation_time, *rule, | 172 extension, extension_installation_time, *rule, |
| 172 ContentRule::ConsistencyChecker(), &error)); | 173 ContentRule::ConsistencyChecker(), &error)); |
| 173 if (!error.empty()) { | 174 if (!error.empty()) { |
| 174 // Clean up temporary condition sets created during rule creation. | 175 // Clean up temporary condition sets created during rule creation. |
| 175 url_matcher_.ClearUnusedConditionSets(); | 176 url_matcher_.ClearUnusedConditionSets(); |
| 176 return error; | 177 return error; |
| 177 } | 178 } |
| 178 DCHECK(content_rule); | 179 DCHECK(content_rule); |
| 179 | 180 |
| 180 new_content_rules[rule_id] = make_linked_ptr(content_rule.release()); | 181 new_content_rules[rule_id] = make_linked_ptr(content_rule.release()); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 334 |
| 334 base::Time ChromeContentRulesRegistry::GetExtensionInstallationTime( | 335 base::Time ChromeContentRulesRegistry::GetExtensionInstallationTime( |
| 335 const std::string& extension_id) const { | 336 const std::string& extension_id) const { |
| 336 if (!extension_info_map_.get()) // May be NULL during testing. | 337 if (!extension_info_map_.get()) // May be NULL during testing. |
| 337 return base::Time(); | 338 return base::Time(); |
| 338 | 339 |
| 339 return extension_info_map_->GetInstallTime(extension_id); | 340 return extension_info_map_->GetInstallTime(extension_id); |
| 340 } | 341 } |
| 341 | 342 |
| 342 } // namespace extensions | 343 } // namespace extensions |
| OLD | NEW |