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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 2236663002: Add origin of settings reset request to feedback reports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dan's comments, take 2 Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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
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
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 bool url_points_to_an_approved_settings_page = false;
530 #if defined(OS_CHROMEOS)
531 // In ChromeOS, allow any settings page to be specified on the command
532 // line. See ExistingUserController::OnLoginSuccess.
533 url_points_to_an_approved_settings_page = base::StartsWith(
534 url.spec(), chrome::kChromeUISettingsURL, base::CompareCase::SENSITIVE);
535 #else
536 // Exposed for external cleaners to offer a settings reset to the
537 // user. The allowed URLs must match exactly.
538 std::string reset_settings_url(chrome::kChromeUISettingsURL);
539 reset_settings_url += chrome::kResetProfileSettingsSubPage;
540 url_points_to_an_approved_settings_page = url.spec() == reset_settings_url;
541 #if defined(OS_WIN)
542 // On Windows, also allow a hash for the Chrome Cleanup Tool.
543 url_points_to_an_approved_settings_page =
544 url_points_to_an_approved_settings_page ||
545 url.spec() == reset_settings_url + "#cct";
Dan Beam 2016/09/06 19:35:18 I think using GURL's == or .Resolve() (or maybe +=
alito 2016/09/16 02:10:37 Changed to use GURL for comparisons instead. Pleas
546 #else
547 #endif // defined(OS_WIN)
548 #endif // defined(OS_CHROMEOS)
549
528 ChildProcessSecurityPolicy* policy = 550 ChildProcessSecurityPolicy* policy =
529 ChildProcessSecurityPolicy::GetInstance(); 551 ChildProcessSecurityPolicy::GetInstance();
530 if (policy->IsWebSafeScheme(url.scheme()) || 552 if (policy->IsWebSafeScheme(url.scheme()) ||
531 url.SchemeIs(url::kFileScheme) || 553 url.SchemeIs(url::kFileScheme) ||
532 #if defined(OS_CHROMEOS) 554 url_points_to_an_approved_settings_page ||
533 // In ChromeOS, allow any settings page to be specified on the command
534 // line. See ExistingUserController::OnLoginSuccess.
535 base::StartsWith(url.spec(), chrome::kChromeUISettingsURL,
536 base::CompareCase::SENSITIVE) ||
537 #else
538 // Exposed for external cleaners to offer a settings reset to the
539 // user. So the URL must match exactly, without any param or prefix.
540 (url.spec() ==
541 std::string(chrome::kChromeUISettingsURL) +
542 chrome::kResetProfileSettingsSubPage) ||
543 #endif
544 (url.spec().compare(url::kAboutBlankURL) == 0)) { 555 (url.spec().compare(url::kAboutBlankURL) == 0)) {
545 urls.push_back(url); 556 urls.push_back(url);
546 } 557 }
547 } 558 }
548 return urls; 559 return urls;
549 } 560 }
550 561
551 bool StartupBrowserCreator::ProcessCmdLineImpl( 562 bool StartupBrowserCreator::ProcessCmdLineImpl(
552 const base::CommandLine& command_line, 563 const base::CommandLine& command_line,
553 const base::FilePath& cur_dir, 564 const base::FilePath& cur_dir,
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 if (!entry->IsSigninRequired()) { 964 if (!entry->IsSigninRequired()) {
954 Profile* profile = profile_manager->GetProfile(entry->GetPath()); 965 Profile* profile = profile_manager->GetProfile(entry->GetPath());
955 if (profile) 966 if (profile)
956 return profile; 967 return profile;
957 } 968 }
958 } 969 }
959 970
960 return nullptr; 971 return nullptr;
961 } 972 }
962 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 973 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698