| 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 18 matching lines...) Expand all Loading... |
| 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( |
| 38 Profile* profile, | 38 Profile* profile, |
| 39 scoped_ptr<RulesRegistryWithCache::RuleStorageOnUI>* ui_part) | 39 scoped_ptr<RulesCacheDelegate>* cache_delegate) |
| 40 : RulesRegistryWithCache((ui_part ? profile : NULL), | 40 : RulesRegistry((cache_delegate ? profile : NULL), |
| 41 declarative_webrequest_constants::kOnRequest, | 41 declarative_webrequest_constants::kOnRequest, |
| 42 content::BrowserThread::IO, | 42 content::BrowserThread::IO, |
| 43 true /*log_storage_init_delay*/, | 43 true /*log_storage_init_delay*/, |
| 44 ui_part), | 44 cache_delegate), |
| 45 profile_id_(profile) { | 45 profile_id_(profile) { |
| 46 if (profile) | 46 if (profile) |
| 47 extension_info_map_ = ExtensionSystem::Get(profile)->info_map(); | 47 extension_info_map_ = ExtensionSystem::Get(profile)->info_map(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 std::set<const WebRequestRule*> WebRequestRulesRegistry::GetMatches( | 50 std::set<const WebRequestRule*> WebRequestRulesRegistry::GetMatches( |
| 51 const WebRequestData& request_data_without_ids) const { | 51 const WebRequestData& request_data_without_ids) const { |
| 52 RuleSet result; | 52 RuleSet result; |
| 53 | 53 |
| 54 WebRequestDataWithMatchIds request_data(&request_data_without_ids); | 54 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); | 400 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match); |
| 401 CHECK(rule_trigger != rule_triggers_.end()); | 401 CHECK(rule_trigger != rule_triggers_.end()); |
| 402 if (!ContainsKey(*result, rule_trigger->second) && | 402 if (!ContainsKey(*result, rule_trigger->second) && |
| 403 rule_trigger->second->conditions().IsFulfilled(*url_match, | 403 rule_trigger->second->conditions().IsFulfilled(*url_match, |
| 404 request_data)) | 404 request_data)) |
| 405 result->insert(rule_trigger->second); | 405 result->insert(rule_trigger->second); |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace extensions | 409 } // namespace extensions |
| OLD | NEW |