Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc

Issue 49693003: Refactor RulesRegistryWithCache to RulesRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698