| 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_webrequest/webrequest_rules_
registry.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_
registry.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 "conditions can be checked and the action can possibly be executed."; | 27 "conditions can be checked and the action can possibly be executed."; |
| 28 | 28 |
| 29 const char kAllURLsPermissionNeeded[] = | 29 const char kAllURLsPermissionNeeded[] = |
| 30 "To execute the action '*', you need to request host permission for all " | 30 "To execute the action '*', you need to request host permission for all " |
| 31 "hosts."; | 31 "hosts."; |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 namespace extensions { | 35 namespace extensions { |
| 36 | 36 |
| 37 WebRequestRulesRegistry::WebRequestRulesRegistry( | 37 WebRequestRulesRegistry::WebRequestRulesRegistry(Profile* profile) |
| 38 Profile* profile, | 38 : RulesRegistry(profile, |
| 39 scoped_ptr<RulesCacheDelegate>* cache_delegate) | 39 declarative_webrequest_constants::kOnRequest, |
| 40 : RulesRegistry((cache_delegate ? profile : NULL), | 40 content::BrowserThread::IO), |
| 41 declarative_webrequest_constants::kOnRequest, | |
| 42 content::BrowserThread::IO, | |
| 43 true /*log_storage_init_delay*/, | |
| 44 cache_delegate), | |
| 45 profile_id_(profile) { | 41 profile_id_(profile) { |
| 46 if (profile) | 42 if (profile) |
| 47 extension_info_map_ = ExtensionSystem::Get(profile)->info_map(); | 43 extension_info_map_ = ExtensionSystem::Get(profile)->info_map(); |
| 48 } | 44 } |
| 49 | 45 |
| 50 std::set<const WebRequestRule*> WebRequestRulesRegistry::GetMatches( | 46 std::set<const WebRequestRule*> WebRequestRulesRegistry::GetMatches( |
| 51 const WebRequestData& request_data_without_ids) const { | 47 const WebRequestData& request_data_without_ids) const { |
| 52 RuleSet result; | 48 RuleSet result; |
| 53 | 49 |
| 54 WebRequestDataWithMatchIds request_data(&request_data_without_ids); | 50 WebRequestDataWithMatchIds request_data(&request_data_without_ids); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match); | 396 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match); |
| 401 CHECK(rule_trigger != rule_triggers_.end()); | 397 CHECK(rule_trigger != rule_triggers_.end()); |
| 402 if (!ContainsKey(*result, rule_trigger->second) && | 398 if (!ContainsKey(*result, rule_trigger->second) && |
| 403 rule_trigger->second->conditions().IsFulfilled(*url_match, | 399 rule_trigger->second->conditions().IsFulfilled(*url_match, |
| 404 request_data)) | 400 request_data)) |
| 405 result->insert(rule_trigger->second); | 401 result->insert(rule_trigger->second); |
| 406 } | 402 } |
| 407 } | 403 } |
| 408 | 404 |
| 409 } // namespace extensions | 405 } // namespace extensions |
| OLD | NEW |