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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 4 years, 5 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 | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/common/importer/firefox_importer_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/startup_browser_creator.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 8cb76a7171ef019ee311ff43e2587668cccb3051..2af51d8755d951afa168fc547f323d055300bc82 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -29,6 +29,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_tokenizer.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
@@ -521,25 +522,27 @@ std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine(
url = url_formatter::FixupRelativeFile(cur_dir, param);
}
// Exclude dangerous schemes.
- if (url.is_valid()) {
- ChildProcessSecurityPolicy* policy =
- ChildProcessSecurityPolicy::GetInstance();
- if (policy->IsWebSafeScheme(url.scheme()) ||
- url.SchemeIs(url::kFileScheme) ||
+ if (!url.is_valid())
+ continue;
+
+ ChildProcessSecurityPolicy* policy =
+ ChildProcessSecurityPolicy::GetInstance();
+ if (policy->IsWebSafeScheme(url.scheme()) ||
+ url.SchemeIs(url::kFileScheme) ||
#if defined(OS_CHROMEOS)
- // In ChromeOS, allow any settings page to be specified on the command
- // line. See ExistingUserController::OnLoginSuccess.
- (url.spec().find(chrome::kChromeUISettingsURL) == 0) ||
+ // In ChromeOS, allow any settings page to be specified on the command
+ // line. See ExistingUserController::OnLoginSuccess.
+ base::StartsWith(url.spec(), chrome::kChromeUISettingsURL,
+ base::CompareCase::SENSITIVE) ||
#else
- // Exposed for external cleaners to offer a settings reset to the
- // user. So the URL must match exactly, without any param or prefix.
- (url.spec() ==
- std::string(chrome::kChromeUISettingsURL) +
- chrome::kResetProfileSettingsSubPage) ||
+ // Exposed for external cleaners to offer a settings reset to the
+ // user. So the URL must match exactly, without any param or prefix.
+ (url.spec() ==
+ std::string(chrome::kChromeUISettingsURL) +
+ chrome::kResetProfileSettingsSubPage) ||
#endif
- (url.spec().compare(url::kAboutBlankURL) == 0)) {
- urls.push_back(url);
- }
+ (url.spec().compare(url::kAboutBlankURL) == 0)) {
+ urls.push_back(url);
}
}
return urls;
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/common/importer/firefox_importer_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698