Remove unneeded empty checks

This commit is contained in:
Kevin Sawicki 2016-12-12 12:42:30 -08:00
parent 04fa85f67f
commit 381f55b3cb
2 changed files with 8 additions and 15 deletions

View file

@ -197,10 +197,9 @@ void AtomContentClient::AddServiceWorkerSchemes(
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kRegisterServiceWorkerSchemes);
if (!schemes.empty()) {
for (const std::string& scheme : schemes)
service_worker_schemes->insert(scheme);
}
for (const std::string& scheme : schemes)
service_worker_schemes->insert(scheme);
service_worker_schemes->insert(url::kFileScheme);
}
@ -209,12 +208,9 @@ void AtomContentClient::AddSecureSchemesAndOrigins(
std::set<GURL>* secure_origins) {
std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kSecureSchemes);
if (!schemes.empty()) {
for (const std::string& scheme : schemes) {
secure_schemes->insert(scheme);
}
}
switches::kSecureSchemes);
for (const std::string& scheme : schemes)
secure_schemes->insert(scheme);
}

View file

@ -124,10 +124,7 @@ bool IsDevToolsExtension(content::RenderFrame* render_frame) {
std::vector<std::string> ParseSchemesCLISwitch(const char* switch_name) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string custom_schemes = command_line->GetSwitchValueASCII(switch_name);
if (!custom_schemes.empty()) {
return base::SplitString(custom_schemes, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
}
return std::vector<std::string>();
return base::SplitString(custom_schemes, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
}
} // namespace
@ -186,7 +183,7 @@ void AtomRendererClient::RenderFrameCreated(
// Allow file scheme to handle service worker by default.
// FIXME(zcbenz): Can this be moved elsewhere?
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file");
// Parse --secure-schemes=scheme1,scheme2
std::vector<std::string> secure_schemes_list = ParseSchemesCLISwitch(switches::kSecureSchemes);
for (const std::string& secure_scheme : secure_schemes_list) {