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