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 12 matching lines...) Expand all Loading... | |
| 23 #include "base/logging.h" | 23 #include "base/logging.h" |
| 24 #include "base/macros.h" | 24 #include "base/macros.h" |
| 25 #include "base/metrics/histogram_macros.h" | 25 #include "base/metrics/histogram_macros.h" |
| 26 #include "base/metrics/statistics_recorder.h" | 26 #include "base/metrics/statistics_recorder.h" |
| 27 #include "base/metrics/user_metrics.h" | 27 #include "base/metrics/user_metrics.h" |
| 28 #include "base/metrics/user_metrics_action.h" | 28 #include "base/metrics/user_metrics_action.h" |
| 29 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
| 30 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
| 31 #include "base/strings/string_tokenizer.h" | 31 #include "base/strings/string_tokenizer.h" |
| 32 #include "base/strings/string_util.h" | 32 #include "base/strings/string_util.h" |
| 33 #include "base/strings/stringprintf.h" | |
| 33 #include "base/strings/utf_string_conversions.h" | 34 #include "base/strings/utf_string_conversions.h" |
| 34 #include "base/threading/thread_restrictions.h" | 35 #include "base/threading/thread_restrictions.h" |
| 35 #include "base/trace_event/trace_event.h" | 36 #include "base/trace_event/trace_event.h" |
| 36 #include "build/build_config.h" | 37 #include "build/build_config.h" |
| 37 #include "chrome/browser/app_mode/app_mode_utils.h" | 38 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 38 #include "chrome/browser/browser_process.h" | 39 #include "chrome/browser/browser_process.h" |
| 39 #include "chrome/browser/chrome_notification_types.h" | 40 #include "chrome/browser/chrome_notification_types.h" |
| 40 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 41 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 41 #include "chrome/browser/extensions/startup_helper.h" | 42 #include "chrome/browser/extensions/startup_helper.h" |
| 42 #include "chrome/browser/extensions/unpacked_installer.h" | 43 #include "chrome/browser/extensions/unpacked_installer.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 // URL, otherwise we will look in the current directory for a file named | 519 // URL, otherwise we will look in the current directory for a file named |
| 519 // 'about' if the browser was started with a about:foo argument. | 520 // 'about' if the browser was started with a about:foo argument. |
| 520 if (!url.is_valid()) { | 521 if (!url.is_valid()) { |
| 521 base::ThreadRestrictions::ScopedAllowIO allow_io; | 522 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 522 url = url_formatter::FixupRelativeFile(cur_dir, param); | 523 url = url_formatter::FixupRelativeFile(cur_dir, param); |
| 523 } | 524 } |
| 524 // Exclude dangerous schemes. | 525 // Exclude dangerous schemes. |
| 525 if (!url.is_valid()) | 526 if (!url.is_valid()) |
| 526 continue; | 527 continue; |
| 527 | 528 |
| 529 #if !defined(OS_CHROMEOS) | |
| 530 static const char kCctHash[] = "CCT"; | |
|
robertshield
2016/08/10 20:35:42
Do you need a # before the CCT?
alito
2016/08/10 21:06:33
Argh. The hash fell off during cleanup. Good catch
| |
| 531 const std::string reset_settings_url = | |
| 532 base::StringPrintf("%s%s", chrome::kChromeUISettingsURL, | |
| 533 chrome::kResetProfileSettingsSubPage); | |
| 534 #endif | |
| 535 | |
| 528 ChildProcessSecurityPolicy* policy = | 536 ChildProcessSecurityPolicy* policy = |
| 529 ChildProcessSecurityPolicy::GetInstance(); | 537 ChildProcessSecurityPolicy::GetInstance(); |
| 530 if (policy->IsWebSafeScheme(url.scheme()) || | 538 if (policy->IsWebSafeScheme(url.scheme()) || |
| 531 url.SchemeIs(url::kFileScheme) || | 539 url.SchemeIs(url::kFileScheme) || |
| 532 #if defined(OS_CHROMEOS) | 540 #if defined(OS_CHROMEOS) |
| 533 // In ChromeOS, allow any settings page to be specified on the command | 541 // In ChromeOS, allow any settings page to be specified on the command |
| 534 // line. See ExistingUserController::OnLoginSuccess. | 542 // line. See ExistingUserController::OnLoginSuccess. |
| 535 base::StartsWith(url.spec(), chrome::kChromeUISettingsURL, | 543 base::StartsWith(url.spec(), chrome::kChromeUISettingsURL, |
| 536 base::CompareCase::SENSITIVE) || | 544 base::CompareCase::SENSITIVE) || |
| 537 #else | 545 #else |
| 538 // Exposed for external cleaners to offer a settings reset to the | 546 // Exposed for external cleaners to offer a settings reset to the |
| 539 // user. So the URL must match exactly, without any param or prefix. | 547 // user. The allowed URLs must match exactly. |
| 540 (url.spec() == | 548 (url.spec() == reset_settings_url) || |
| 541 std::string(chrome::kChromeUISettingsURL) + | 549 (url.spec() == reset_settings_url + kCctHash) || |
| 542 chrome::kResetProfileSettingsSubPage) || | |
| 543 #endif | 550 #endif |
| 544 (url.spec().compare(url::kAboutBlankURL) == 0)) { | 551 (url.spec().compare(url::kAboutBlankURL) == 0)) { |
| 545 urls.push_back(url); | 552 urls.push_back(url); |
| 546 } | 553 } |
| 547 } | 554 } |
| 548 return urls; | 555 return urls; |
| 549 } | 556 } |
| 550 | 557 |
| 551 bool StartupBrowserCreator::ProcessCmdLineImpl( | 558 bool StartupBrowserCreator::ProcessCmdLineImpl( |
| 552 const base::CommandLine& command_line, | 559 const base::CommandLine& command_line, |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 if (!entry->IsSigninRequired()) { | 960 if (!entry->IsSigninRequired()) { |
| 954 Profile* profile = profile_manager->GetProfile(entry->GetPath()); | 961 Profile* profile = profile_manager->GetProfile(entry->GetPath()); |
| 955 if (profile) | 962 if (profile) |
| 956 return profile; | 963 return profile; |
| 957 } | 964 } |
| 958 } | 965 } |
| 959 | 966 |
| 960 return nullptr; | 967 return nullptr; |
| 961 } | 968 } |
| 962 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 969 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| OLD | NEW |