Chromium Code Reviews| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 std::set<ContentRule*>& prev_matching_rules = active_rules_[tab_id]; | 77 std::set<ContentRule*>& prev_matching_rules = active_rules_[tab_id]; |
| 78 ContentAction::ApplyInfo apply_info = { | 78 ContentAction::ApplyInfo apply_info = { |
| 79 profile(), contents | 79 profile(), contents |
| 80 }; | 80 }; |
| 81 for (std::set<ContentRule*>::const_iterator it = matching_rules.begin(); | 81 for (std::set<ContentRule*>::const_iterator it = matching_rules.begin(); |
| 82 it != matching_rules.end(); ++it) { | 82 it != matching_rules.end(); ++it) { |
| 83 if (!ContainsKey(prev_matching_rules, *it)) | 83 if (!ContainsKey(prev_matching_rules, *it)) |
| 84 (*it)->actions().Apply((*it)->extension_id(), base::Time(), &apply_info); | 84 (*it)->actions().Apply((*it)->extension_id(), base::Time(), &apply_info); |
| 85 else | |
| 86 (*it)->actions().Reapply( | |
| 87 (*it)->extension_id(), base::Time(), &apply_info); | |
|
not at google - send to devlin
2014/08/21 00:32:56
Nit: this body is 2 lines, so it should be inside
Mark Dittmer
2014/08/21 01:08:48
Done.
| |
| 85 } | 88 } |
| 86 for (std::set<ContentRule*>::const_iterator it = prev_matching_rules.begin(); | 89 for (std::set<ContentRule*>::const_iterator it = prev_matching_rules.begin(); |
| 87 it != prev_matching_rules.end(); ++it) { | 90 it != prev_matching_rules.end(); ++it) { |
| 88 if (!ContainsKey(matching_rules, *it)) | 91 if (!ContainsKey(matching_rules, *it)) |
| 89 (*it)->actions().Revert((*it)->extension_id(), base::Time(), &apply_info); | 92 (*it)->actions().Revert((*it)->extension_id(), base::Time(), &apply_info); |
| 90 } | 93 } |
| 91 | 94 |
| 92 if (matching_rules.empty()) | 95 if (matching_rules.empty()) |
| 93 active_rules_.erase(tab_id); | 96 active_rules_.erase(tab_id); |
| 94 else | 97 else |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 | 315 |
| 313 base::Time ContentRulesRegistry::GetExtensionInstallationTime( | 316 base::Time ContentRulesRegistry::GetExtensionInstallationTime( |
| 314 const std::string& extension_id) const { | 317 const std::string& extension_id) const { |
| 315 if (!extension_info_map_.get()) // May be NULL during testing. | 318 if (!extension_info_map_.get()) // May be NULL during testing. |
| 316 return base::Time(); | 319 return base::Time(); |
| 317 | 320 |
| 318 return extension_info_map_->GetInstallTime(extension_id); | 321 return extension_info_map_->GetInstallTime(extension_id); |
| 319 } | 322 } |
| 320 | 323 |
| 321 } // namespace extensions | 324 } // namespace extensions |
| OLD | NEW |