Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> // For max(). | 9 #include <algorithm> // For max(). |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 // URL, otherwise we will look in the current directory for a file named | 514 // URL, otherwise we will look in the current directory for a file named |
| 515 // 'about' if the browser was started with a about:foo argument. | 515 // 'about' if the browser was started with a about:foo argument. |
| 516 if (!url.is_valid()) { | 516 if (!url.is_valid()) { |
| 517 base::ThreadRestrictions::ScopedAllowIO allow_io; | 517 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 518 url = url_formatter::FixupRelativeFile(cur_dir, param); | 518 url = url_formatter::FixupRelativeFile(cur_dir, param); |
| 519 } | 519 } |
| 520 // Exclude dangerous schemes. | 520 // Exclude dangerous schemes. |
| 521 if (!url.is_valid()) | 521 if (!url.is_valid()) |
| 522 continue; | 522 continue; |
| 523 | 523 |
| 524 const GURL settings_url = GURL(chrome::kChromeUISettingsURL); | |
| 525 bool url_points_to_an_approved_settings_page = false; | |
| 526 #if defined(OS_CHROMEOS) | |
| 527 // In ChromeOS, allow any settings page to be specified on the command | |
| 528 // line. See ExistingUserController::OnLoginSuccess. | |
|
sky
2016/09/16 21:53:05
There is no ExistingUserController::OnLoginSuccess
alito
2016/09/17 20:23:31
Well, it seems this comment was introduced in 2010
| |
| 529 url_points_to_an_approved_settings_page = | |
| 530 url.GetOrigin() == settings_url.GetOrigin(); | |
| 531 #else | |
| 532 // Exposed for external cleaners to offer a settings reset to the | |
| 533 // user. The allowed URLs must match exactly. | |
| 534 const GURL reset_settings_url = | |
| 535 settings_url.Resolve(chrome::kResetProfileSettingsSubPage); | |
| 536 url_points_to_an_approved_settings_page = url == reset_settings_url; | |
| 537 #if defined(OS_WIN) | |
| 538 // On Windows, also allow a hash for the Chrome Cleanup Tool. | |
| 539 url_points_to_an_approved_settings_page = | |
| 540 url_points_to_an_approved_settings_page || | |
| 541 url == reset_settings_url.Resolve("#cct"); | |
|
sky
2016/09/16 21:53:05
Would it make sense to define this hash some where
alito
2016/09/17 20:23:31
It was a bit hard to find it a nice home. I've def
sky
2016/09/18 16:14:03
I wouldn't expect the has in a util file. Maybe Da
| |
| 542 #endif // defined(OS_WIN) | |
| 543 #endif // defined(OS_CHROMEOS) | |
| 544 | |
| 524 ChildProcessSecurityPolicy* policy = | 545 ChildProcessSecurityPolicy* policy = |
| 525 ChildProcessSecurityPolicy::GetInstance(); | 546 ChildProcessSecurityPolicy::GetInstance(); |
| 526 if (policy->IsWebSafeScheme(url.scheme()) || | 547 if (policy->IsWebSafeScheme(url.scheme()) || |
| 527 url.SchemeIs(url::kFileScheme) || | 548 url.SchemeIs(url::kFileScheme) || |
| 528 #if defined(OS_CHROMEOS) | 549 url_points_to_an_approved_settings_page || |
| 529 // In ChromeOS, allow any settings page to be specified on the command | |
| 530 // line. See ExistingUserController::OnLoginSuccess. | |
| 531 base::StartsWith(url.spec(), chrome::kChromeUISettingsURL, | |
| 532 base::CompareCase::SENSITIVE) || | |
| 533 #else | |
| 534 // Exposed for external cleaners to offer a settings reset to the | |
| 535 // user. So the URL must match exactly, without any param or prefix. | |
| 536 (url.spec() == | |
| 537 std::string(chrome::kChromeUISettingsURL) + | |
| 538 chrome::kResetProfileSettingsSubPage) || | |
| 539 #endif | |
| 540 (url.spec().compare(url::kAboutBlankURL) == 0)) { | 550 (url.spec().compare(url::kAboutBlankURL) == 0)) { |
| 541 urls.push_back(url); | 551 urls.push_back(url); |
| 542 } | 552 } |
| 543 } | 553 } |
| 544 return urls; | 554 return urls; |
| 545 } | 555 } |
| 546 | 556 |
| 547 bool StartupBrowserCreator::ProcessCmdLineImpl( | 557 bool StartupBrowserCreator::ProcessCmdLineImpl( |
| 548 const base::CommandLine& command_line, | 558 const base::CommandLine& command_line, |
| 549 const base::FilePath& cur_dir, | 559 const base::FilePath& cur_dir, |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 if (!entry->IsSigninRequired()) { | 944 if (!entry->IsSigninRequired()) { |
| 935 Profile* profile = profile_manager->GetProfile(entry->GetPath()); | 945 Profile* profile = profile_manager->GetProfile(entry->GetPath()); |
| 936 if (profile) | 946 if (profile) |
| 937 return profile; | 947 return profile; |
| 938 } | 948 } |
| 939 } | 949 } |
| 940 | 950 |
| 941 return nullptr; | 951 return nullptr; |
| 942 } | 952 } |
| 943 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 953 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| OLD | NEW |