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; std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",", ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kRegisterServiceWorkerSchemes); switches::kRegisterServiceWorkerSchemes);
if (!schemes.empty()) { for (const std::string& scheme : schemes)
for (const std::string& scheme : schemes) service_worker_schemes->insert(scheme);
service_worker_schemes->insert(scheme);
}
service_worker_schemes->insert(url::kFileScheme); service_worker_schemes->insert(url::kFileScheme);
} }
@ -209,12 +208,9 @@ void AtomContentClient::AddSecureSchemesAndOrigins(
std::set<GURL>* secure_origins) { std::set<GURL>* secure_origins) {
std::vector<std::string> schemes; std::vector<std::string> schemes;
ConvertStringWithSeparatorToVector(&schemes, ",", ConvertStringWithSeparatorToVector(&schemes, ",",
switches::kSecureSchemes); switches::kSecureSchemes);
if (!schemes.empty()) { for (const std::string& scheme : schemes)
for (const std::string& scheme : schemes) { secure_schemes->insert(scheme);
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) { std::vector<std::string> ParseSchemesCLISwitch(const char* switch_name) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string custom_schemes = command_line->GetSwitchValueASCII(switch_name); 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 base::SplitString(custom_schemes, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
}
return std::vector<std::string>();
} }
} // namespace } // namespace
@ -186,7 +183,7 @@ void AtomRendererClient::RenderFrameCreated(
// Allow file scheme to handle service worker by default. // Allow file scheme to handle service worker by default.
// FIXME(zcbenz): Can this be moved elsewhere? // FIXME(zcbenz): Can this be moved elsewhere?
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file"); blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file");
// Parse --secure-schemes=scheme1,scheme2 // Parse --secure-schemes=scheme1,scheme2
std::vector<std::string> secure_schemes_list = ParseSchemesCLISwitch(switches::kSecureSchemes); std::vector<std::string> secure_schemes_list = ParseSchemesCLISwitch(switches::kSecureSchemes);
for (const std::string& secure_scheme : secure_schemes_list) { for (const std::string& secure_scheme : secure_schemes_list) {