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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition.cc

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces Created 4 years, 4 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
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 "extensions/browser/api/declarative_webrequest/webrequest_condition.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 bool WebRequestCondition::IsFulfilled( 93 bool WebRequestCondition::IsFulfilled(
94 const MatchData& request_data) const { 94 const MatchData& request_data) const {
95 if (!(request_data.data->stage & applicable_request_stages_)) { 95 if (!(request_data.data->stage & applicable_request_stages_)) {
96 // A condition that cannot be evaluated is considered as violated. 96 // A condition that cannot be evaluated is considered as violated.
97 return false; 97 return false;
98 } 98 }
99 99
100 // Check URL attributes if present. 100 // Check URL attributes if present.
101 if (url_matcher_conditions_.get() && 101 if (url_matcher_conditions_.get() &&
102 !ContainsKey(request_data.url_match_ids, url_matcher_conditions_->id())) 102 !base::ContainsKey(request_data.url_match_ids,
103 url_matcher_conditions_->id()))
103 return false; 104 return false;
104 if (first_party_url_matcher_conditions_.get() && 105 if (first_party_url_matcher_conditions_.get() &&
105 !ContainsKey(request_data.first_party_url_match_ids, 106 !base::ContainsKey(request_data.first_party_url_match_ids,
106 first_party_url_matcher_conditions_->id())) 107 first_party_url_matcher_conditions_->id()))
107 return false; 108 return false;
108 109
109 // All condition attributes must be fulfilled for a fulfilled condition. 110 // All condition attributes must be fulfilled for a fulfilled condition.
110 for (WebRequestConditionAttributes::const_iterator i = 111 for (WebRequestConditionAttributes::const_iterator i =
111 condition_attributes_.begin(); 112 condition_attributes_.begin();
112 i != condition_attributes_.end(); ++i) { 113 i != condition_attributes_.end(); ++i) {
113 if (!(*i)->IsFulfilled(*(request_data.data))) 114 if (!(*i)->IsFulfilled(*(request_data.data)))
114 return false; 115 return false;
115 } 116 }
116 return true; 117 return true;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 if (!result->stages()) { 196 if (!result->stages()) {
196 *error = kConditionCannotBeFulfilled; 197 *error = kConditionCannotBeFulfilled;
197 return std::unique_ptr<WebRequestCondition>(); 198 return std::unique_ptr<WebRequestCondition>();
198 } 199 }
199 200
200 return result; 201 return result;
201 } 202 }
202 203
203 } // namespace extensions 204 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698