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

Side by Side Diff: chrome/browser/extensions/api/declarative/url_matcher.cc

Issue 9820003: Implementation of beginning of Declarative Web Request API backend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pacify clang Created 8 years, 8 months 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 | Annotate | Revision Log
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/url_matcher.h" 5 #include "chrome/browser/extensions/api/declarative/url_matcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 const std::vector<URLMatcherConditionSet::ID>& condition_set_ids) { 438 const std::vector<URLMatcherConditionSet::ID>& condition_set_ids) {
439 for (std::vector<URLMatcherConditionSet::ID>::const_iterator i = 439 for (std::vector<URLMatcherConditionSet::ID>::const_iterator i =
440 condition_set_ids.begin(); i != condition_set_ids.end(); ++i) { 440 condition_set_ids.begin(); i != condition_set_ids.end(); ++i) {
441 DCHECK(url_matcher_condition_sets_.find(*i) != 441 DCHECK(url_matcher_condition_sets_.find(*i) !=
442 url_matcher_condition_sets_.end()); 442 url_matcher_condition_sets_.end());
443 url_matcher_condition_sets_.erase(*i); 443 url_matcher_condition_sets_.erase(*i);
444 } 444 }
445 UpdateInternalDatastructures(); 445 UpdateInternalDatastructures();
446 } 446 }
447 447
448 void URLMatcher::ClearUnusedConditionSets() {
449 UpdateConditionFactory();
450 }
451
448 std::set<URLMatcherConditionSet::ID> URLMatcher::MatchURL(const GURL& url) { 452 std::set<URLMatcherConditionSet::ID> URLMatcher::MatchURL(const GURL& url) {
449 // Find all IDs of SubstringPatterns that match |url|. 453 // Find all IDs of SubstringPatterns that match |url|.
450 // See URLMatcherConditionFactory for the canonicalization of URLs and the 454 // See URLMatcherConditionFactory for the canonicalization of URLs and the
451 // distinction between full url searches and url component searches. 455 // distinction between full url searches and url component searches.
452 std::set<SubstringPattern::ID> matches; 456 std::set<SubstringPattern::ID> matches;
453 full_url_matcher_.Match( 457 full_url_matcher_.Match(
454 condition_factory_.CanonicalizeURLForFullSearches(url), &matches); 458 condition_factory_.CanonicalizeURLForFullSearches(url), &matches);
455 url_component_matcher_.Match( 459 url_component_matcher_.Match(
456 condition_factory_.CanonicalizeURLForComponentSearches(url), &matches); 460 condition_factory_.CanonicalizeURLForComponentSearches(url), &matches);
457 461
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 604 }
601 605
602 void URLMatcher::UpdateInternalDatastructures() { 606 void URLMatcher::UpdateInternalDatastructures() {
603 UpdateSubstringSetMatcher(false); 607 UpdateSubstringSetMatcher(false);
604 UpdateSubstringSetMatcher(true); 608 UpdateSubstringSetMatcher(true);
605 UpdateTriggers(); 609 UpdateTriggers();
606 UpdateConditionFactory(); 610 UpdateConditionFactory();
607 } 611 }
608 612
609 } // namespace extensions 613 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698