| 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()), | |
| 172 extension, extension_installation_time, *rule, | 171 extension, extension_installation_time, *rule, |
| 173 ContentRule::ConsistencyChecker(), &error)); | 172 ContentRule::ConsistencyChecker(), &error)); |
| 174 if (!error.empty()) { | 173 if (!error.empty()) { |
| 175 // Clean up temporary condition sets created during rule creation. | 174 // Clean up temporary condition sets created during rule creation. |
| 176 url_matcher_.ClearUnusedConditionSets(); | 175 url_matcher_.ClearUnusedConditionSets(); |
| 177 return error; | 176 return error; |
| 178 } | 177 } |
| 179 DCHECK(content_rule); | 178 DCHECK(content_rule); |
| 180 | 179 |
| 181 new_content_rules[rule_id] = make_linked_ptr(content_rule.release()); | 180 new_content_rules[rule_id] = make_linked_ptr(content_rule.release()); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 333 |
| 335 base::Time ChromeContentRulesRegistry::GetExtensionInstallationTime( | 334 base::Time ChromeContentRulesRegistry::GetExtensionInstallationTime( |
| 336 const std::string& extension_id) const { | 335 const std::string& extension_id) const { |
| 337 if (!extension_info_map_.get()) // May be NULL during testing. | 336 if (!extension_info_map_.get()) // May be NULL during testing. |
| 338 return base::Time(); | 337 return base::Time(); |
| 339 | 338 |
| 340 return extension_info_map_->GetInstallTime(extension_id); | 339 return extension_info_map_->GetInstallTime(extension_id); |
| 341 } | 340 } |
| 342 | 341 |
| 343 } // namespace extensions | 342 } // namespace extensions |
| OLD | NEW |