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

Unified Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 2950263003: Use ContainsValue() instead of std::find() in extensions/ (Closed)
Patch Set: Rebase patch. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | extensions/browser/api/document_scan/document_scan_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
index 626c2433cf3d3d99ad5d0f69ded14294f851a8ca..95263dca290d763224a0e68b8dee27f3e3868e72 100644
--- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -6,7 +6,6 @@
#include <stddef.h>
-#include <algorithm>
#include <utility>
#include <vector>
@@ -14,6 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -182,7 +182,7 @@ bool WebRequestConditionAttributeResourceType::IsFulfilled(
if (!(request_data.stage & GetStages()))
return false;
const auto resource_type = GetWebRequestResourceType(request_data.request);
- return std::find(types_.begin(), types_.end(), resource_type) != types_.end();
+ return base::ContainsValue(types_, resource_type);
}
WebRequestConditionAttribute::Type
@@ -266,11 +266,9 @@ bool WebRequestConditionAttributeContentType::IsFulfilled(
content_type, &mime_type, &charset, &had_charset, NULL);
if (inclusive_) {
- return std::find(content_types_.begin(), content_types_.end(),
- mime_type) != content_types_.end();
+ return base::ContainsValue(content_types_, mime_type);
} else {
- return std::find(content_types_.begin(), content_types_.end(),
- mime_type) == content_types_.end();
+ return !base::ContainsValue(content_types_, mime_type);
}
}
« no previous file with comments | « no previous file | extensions/browser/api/document_scan/document_scan_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698