Commit 07c5e52d authored by Ganesh Borle's avatar Ganesh Borle Committed by Commit Bot

Changed std::find() to ContainsValue() in src/chrome/browser* - Set 1

Bug: 561800
Change-Id: I9da77edbdb6777a3fc25bed30275c72e9790d88f
Reviewed-on: https://chromium-review.googlesource.com/952882Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Tanvir Rizvi <tanvir.rizvi@samsung.com>
Cr-Commit-Position: refs/heads/master@{#566772}
parent 2370c7a9
......@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/stl_util.h"
#include "base/strings/string_split.h"
#include "chromeos/chromeos_switches.h"
......@@ -89,7 +90,7 @@ bool ForceShowOobeScreen(OobeScreen screen) {
std::vector<std::string> screens = base::SplitString(
option_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
std::string name = GetOobeScreenName(screen);
return std::find(screens.begin(), screens.end(), name) != screens.end();
return base::ContainsValue(screens, name);
}
} // namespace chromeos
......@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/values.h"
#include "chrome/common/pref_names.h"
#include "components/policy/core/common/policy_map.h"
......@@ -147,9 +148,8 @@ bool PolicyAllowsCorporateKeyUsageForExtension(
bool IsKeyOnUserSlot(
const std::vector<KeyPermissions::KeyLocation>& key_locations) {
return std::find(key_locations.begin(), key_locations.end(),
KeyPermissions::KeyLocation::kUserSlot) !=
key_locations.end();
return base::ContainsValue(key_locations,
KeyPermissions::KeyLocation::kUserSlot);
}
} // namespace
......
......@@ -15,6 +15,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/version.h"
#include "chrome/browser/vr/assets_loader.h"
......@@ -51,8 +52,7 @@ void VrAssetsComponentInstallerPolicy::UpdateComponent(
const std::string crx_id = crx_file::id_util::GenerateIdFromHash(
kVrAssetsPublicKeySHA256, sizeof(kVrAssetsPublicKeySHA256));
// Make sure the component is registered.
DCHECK(std::find(cus->GetComponentIDs().begin(), cus->GetComponentIDs().end(),
crx_id) != cus->GetComponentIDs().end());
DCHECK(base::ContainsValue(cus->GetComponentIDs(), crx_id));
cus->GetOnDemandUpdater().OnDemandUpdate(
crx_id, base::BindOnce([](update_client::Error error) { return; }));
#endif // BUILDFLAG(USE_VR_ASSETS_COMPONENT)
......
......@@ -275,8 +275,7 @@ LanguageSettingsPrivateDisableLanguageFunction::Run() {
std::string chrome_language = language_code;
translate::ToChromeLanguageSynonym(&chrome_language);
auto it = std::find(languages.begin(), languages.end(), chrome_language);
if (it == languages.end()) {
if (!base::ContainsValue(languages, chrome_language)) {
LOG(ERROR) << "Language " << chrome_language << " not enabled";
return RespondNow(NoArguments());
}
......
......@@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/threading/thread_restrictions.h"
......@@ -125,8 +126,7 @@ IN_PROC_BROWSER_TEST_P(ProfileNetworkContextServiceBrowsertest, BrotliEnabled) {
std::vector<std::string> encodings =
base::SplitString(*simple_loader_helper.response_body(), ",",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
EXPECT_TRUE(encodings.end() !=
std::find(encodings.begin(), encodings.end(), "br"));
EXPECT_TRUE(base::ContainsValue(encodings, "br"));
}
// Test subclass that adds switches::kDiskCacheDir to the command line, to make
......
......@@ -161,9 +161,7 @@ class ServiceWorkerPaymentAppFactoryBrowserTest : public InProcessBrowserTest {
}
}
ASSERT_NE(nullptr, app) << "No app found in scope " << scope;
EXPECT_NE(app->enabled_methods.end(),
std::find(app->enabled_methods.begin(),
app->enabled_methods.end(), expected_method))
EXPECT_TRUE(base::ContainsValue(app->enabled_methods, expected_method))
<< "Unable to find payment method " << expected_method
<< " in the list of enabled methods for the app installed from "
<< app->scope;
......
......@@ -188,8 +188,7 @@ class PolicyTestCase {
#else
#error "Unknown platform"
#endif
return std::find(supported_os_.begin(), supported_os_.end(), os) !=
supported_os_.end();
return base::ContainsValue(supported_os_, os);
}
void AddSupportedOs(const std::string& os) { supported_os_.push_back(os); }
......
......@@ -4,6 +4,7 @@
#include "chrome/browser/profiling_host/background_profiling_triggers.h"
#include "base/stl_util.h"
#include "base/task_scheduler/post_task.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
......@@ -141,8 +142,7 @@ void BackgroundProfilingTriggers::OnReceivedMemoryDump(
bool should_send_report = false;
for (const auto& proc : dump->process_dumps()) {
if (std::find(profiled_pids.begin(), profiled_pids.end(), proc.pid()) ==
profiled_pids.end())
if (!base::ContainsValue(profiled_pids, proc.pid()))
continue;
if (IsOverTriggerThreshold(GetContentProcessType(proc.process_type()),
proc.os_dump().private_footprint_kb)) {
......
......@@ -9,6 +9,7 @@
#include "ash/shell.h"
#include "base/json/json_writer.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
......@@ -559,8 +560,7 @@ void Intent::AddExtraParam(const std::string& extra_param) {
}
bool Intent::HasExtraParam(const std::string& extra_param) const {
return std::find(extra_params_.begin(), extra_params_.end(), extra_param) !=
extra_params_.end();
return base::ContainsValue(extra_params_, extra_param);
}
} // namespace arc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment