Chromium Code Reviews| 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 639d5b2cb93b32b163a02154077598946e5bb364..733e36cdb4b7b8d57c84ad02171048144abaf244 100644 |
| --- a/chrome/browser/ui/startup/startup_browser_creator.cc |
| +++ b/chrome/browser/ui/startup/startup_browser_creator.cc |
| @@ -30,6 +30,7 @@ |
| #include "base/strings/string_split.h" |
| #include "base/strings/string_tokenizer.h" |
| #include "base/strings/string_util.h" |
| +#include "base/strings/stringprintf.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/threading/thread_restrictions.h" |
| #include "base/trace_event/trace_event.h" |
| @@ -525,22 +526,32 @@ std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( |
| if (!url.is_valid()) |
| continue; |
| + bool url_is_allowed_settings_page = false; |
|
Dan Beam
2016/08/23 05:48:23
this name doesn't make much sense to me
alito
2016/08/23 18:20:34
Changed to url_points_to_an_approved_settings_page
|
| +#if defined(OS_CHROMEOS) |
| + // In ChromeOS, allow any settings page to be specified on the command |
| + // line. See ExistingUserController::OnLoginSuccess. |
| + url_is_allowed_settings_page = base::StartsWith( |
| + url.spec(), chrome::kChromeUISettingsURL, base::CompareCase::SENSITIVE); |
|
Dan Beam
2016/08/23 05:48:23
why not compare URL.GetOrigin() == GURL(chrome::kC
alito
2016/08/23 18:20:35
Since I'm not able to test a ChromeOS build and th
|
| +#else |
| + // Exposed for external cleaners to offer a settings reset to the |
| + // user. The allowed URLs must match exactly. |
| + const std::string reset_settings_url = |
| + base::StringPrintf("%s%s", chrome::kChromeUISettingsURL, |
|
Dan Beam
2016/08/23 05:48:23
why not just append these char* to reset_settings_
alito
2016/08/23 18:20:35
Changed to append to reset_settings_url.
|
| + chrome::kResetProfileSettingsSubPage); |
| + url_is_allowed_settings_page = url.spec() == reset_settings_url; |
| +#if defined(OS_WIN) |
| + // On Windows, also allow a hash for the Chrome Cleanup Tool. |
| + url_is_allowed_settings_page = url_is_allowed_settings_page || |
| + url.spec() == reset_settings_url + "#CCT"; |
|
Dan Beam
2016/08/23 05:48:23
why is this uppercase?
alito
2016/08/23 18:20:34
Changed to lowercase.
|
| +#else |
| +#endif // defined(OS_WIN) |
| +#endif // defined(OS_CHROMEOS) |
| + |
| 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. |
| - 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) || |
| -#endif |
| + url_is_allowed_settings_page || |
| (url.spec().compare(url::kAboutBlankURL) == 0)) { |
| urls.push_back(url); |
| } |