| 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/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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 std::string error; | 153 std::string error; |
| 154 RulesMap new_content_rules; | 154 RulesMap new_content_rules; |
| 155 | 155 |
| 156 for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator rule = | 156 for (std::vector<linked_ptr<RulesRegistry::Rule> >::const_iterator rule = |
| 157 rules.begin(); rule != rules.end(); ++rule) { | 157 rules.begin(); rule != rules.end(); ++rule) { |
| 158 ContentRule::GlobalRuleId rule_id(extension_id, *(*rule)->id); | 158 ContentRule::GlobalRuleId rule_id(extension_id, *(*rule)->id); |
| 159 DCHECK(content_rules_.find(rule_id) == content_rules_.end()); | 159 DCHECK(content_rules_.find(rule_id) == content_rules_.end()); |
| 160 | 160 |
| 161 scoped_ptr<ContentRule> content_rule( | 161 scoped_ptr<ContentRule> content_rule( |
| 162 ContentRule::Create(url_matcher_.condition_factory(), | 162 ContentRule::Create(url_matcher_.condition_factory(), |
| 163 profile(), |
| 163 extension, | 164 extension, |
| 164 extension_installation_time, | 165 extension_installation_time, |
| 165 *rule, | 166 *rule, |
| 166 ContentRule::ConsistencyChecker(), | 167 ContentRule::ConsistencyChecker(), |
| 167 &error)); | 168 &error)); |
| 168 if (!error.empty()) { | 169 if (!error.empty()) { |
| 169 // Clean up temporary condition sets created during rule creation. | 170 // Clean up temporary condition sets created during rule creation. |
| 170 url_matcher_.ClearUnusedConditionSets(); | 171 url_matcher_.ClearUnusedConditionSets(); |
| 171 return error; | 172 return error; |
| 172 } | 173 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 317 |
| 317 base::Time ContentRulesRegistry::GetExtensionInstallationTime( | 318 base::Time ContentRulesRegistry::GetExtensionInstallationTime( |
| 318 const std::string& extension_id) const { | 319 const std::string& extension_id) const { |
| 319 if (!extension_info_map_.get()) // May be NULL during testing. | 320 if (!extension_info_map_.get()) // May be NULL during testing. |
| 320 return base::Time(); | 321 return base::Time(); |
| 321 | 322 |
| 322 return extension_info_map_->GetInstallTime(extension_id); | 323 return extension_info_map_->GetInstallTime(extension_id); |
| 323 } | 324 } |
| 324 | 325 |
| 325 } // namespace extensions | 326 } // namespace extensions |
| OLD | NEW |