| 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 "extensions/common/matcher/url_matcher.h" | 5 #include "extensions/common/matcher/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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 745     } | 745     } | 
| 746   } | 746   } | 
| 747 | 747 | 
| 748   // This is the set of patterns that were registered before this function | 748   // This is the set of patterns that were registered before this function | 
| 749   // is called. | 749   // is called. | 
| 750   std::set<const StringPattern*>& registered_patterns = | 750   std::set<const StringPattern*>& registered_patterns = | 
| 751       full_url_conditions ? registered_full_url_patterns_ | 751       full_url_conditions ? registered_full_url_patterns_ | 
| 752                           : registered_url_component_patterns_; | 752                           : registered_url_component_patterns_; | 
| 753 | 753 | 
| 754   // Add all patterns that are in new_patterns but not in registered_patterns. | 754   // Add all patterns that are in new_patterns but not in registered_patterns. | 
| 755   std::vector<const StringPattern*> patterns_to_register; | 755   std::vector<const StringPattern*> patterns_to_register = | 
| 756   std::set_difference( | 756       base::STLSetDifference<std::vector<const StringPattern*> >( | 
| 757       new_patterns.begin(), new_patterns.end(), | 757           new_patterns, registered_patterns); | 
| 758       registered_patterns.begin(), registered_patterns.end(), |  | 
| 759       std::back_inserter(patterns_to_register)); |  | 
| 760 | 758 | 
| 761   // Remove all patterns that are in registered_patterns but not in | 759   // Remove all patterns that are in registered_patterns but not in | 
| 762   // new_patterns. | 760   // new_patterns. | 
| 763   std::vector<const StringPattern*> patterns_to_unregister; | 761   std::vector<const StringPattern*> patterns_to_unregister = | 
| 764   std::set_difference( | 762       base::STLSetDifference<std::vector<const StringPattern*> >( | 
| 765       registered_patterns.begin(), registered_patterns.end(), | 763            registered_patterns, new_patterns); | 
| 766       new_patterns.begin(), new_patterns.end(), |  | 
| 767       std::back_inserter(patterns_to_unregister)); |  | 
| 768 | 764 | 
| 769   // Update the SubstringSetMatcher. | 765   // Update the SubstringSetMatcher. | 
| 770   SubstringSetMatcher& url_matcher = | 766   SubstringSetMatcher& url_matcher = | 
| 771       full_url_conditions ? full_url_matcher_ : url_component_matcher_; | 767       full_url_conditions ? full_url_matcher_ : url_component_matcher_; | 
| 772   url_matcher.RegisterAndUnregisterPatterns(patterns_to_register, | 768   url_matcher.RegisterAndUnregisterPatterns(patterns_to_register, | 
| 773                                             patterns_to_unregister); | 769                                             patterns_to_unregister); | 
| 774 | 770 | 
| 775   // Update the set of registered_patterns for the next time this function | 771   // Update the set of registered_patterns for the next time this function | 
| 776   // is being called. | 772   // is being called. | 
| 777   registered_patterns.swap(new_patterns); | 773   registered_patterns.swap(new_patterns); | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 876 | 872 | 
| 877 void URLMatcher::UpdateInternalDatastructures() { | 873 void URLMatcher::UpdateInternalDatastructures() { | 
| 878   UpdateSubstringSetMatcher(false); | 874   UpdateSubstringSetMatcher(false); | 
| 879   UpdateSubstringSetMatcher(true); | 875   UpdateSubstringSetMatcher(true); | 
| 880   UpdateRegexSetMatcher(); | 876   UpdateRegexSetMatcher(); | 
| 881   UpdateTriggers(); | 877   UpdateTriggers(); | 
| 882   UpdateConditionFactory(); | 878   UpdateConditionFactory(); | 
| 883 } | 879 } | 
| 884 | 880 | 
| 885 }  // namespace extensions | 881 }  // namespace extensions | 
| OLD | NEW | 
|---|