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

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: Move cct hash definition to options::ResetProfileSettingsHandler Created 4 years, 3 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "chrome/browser/profiles/profile_attributes_storage.h" 49 #include "chrome/browser/profiles/profile_attributes_storage.h"
50 #include "chrome/browser/profiles/profile_manager.h" 50 #include "chrome/browser/profiles/profile_manager.h"
51 #include "chrome/browser/profiles/profiles_state.h" 51 #include "chrome/browser/profiles/profiles_state.h"
52 #include "chrome/browser/search_engines/template_url_service_factory.h" 52 #include "chrome/browser/search_engines/template_url_service_factory.h"
53 #include "chrome/browser/ui/browser.h" 53 #include "chrome/browser/ui/browser.h"
54 #include "chrome/browser/ui/browser_dialogs.h" 54 #include "chrome/browser/ui/browser_dialogs.h"
55 #include "chrome/browser/ui/browser_finder.h" 55 #include "chrome/browser/ui/browser_finder.h"
56 #include "chrome/browser/ui/browser_window.h" 56 #include "chrome/browser/ui/browser_window.h"
57 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" 57 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
58 #include "chrome/browser/ui/user_manager.h" 58 #include "chrome/browser/ui/user_manager.h"
59 #include "chrome/browser/ui/webui/options/reset_profile_settings_handler.h"
59 #include "chrome/common/chrome_constants.h" 60 #include "chrome/common/chrome_constants.h"
60 #include "chrome/common/chrome_paths.h" 61 #include "chrome/common/chrome_paths.h"
61 #include "chrome/common/chrome_result_codes.h" 62 #include "chrome/common/chrome_result_codes.h"
62 #include "chrome/common/chrome_switches.h" 63 #include "chrome/common/chrome_switches.h"
63 #include "chrome/common/pref_names.h" 64 #include "chrome/common/pref_names.h"
64 #include "chrome/common/url_constants.h" 65 #include "chrome/common/url_constants.h"
65 #include "chrome/installer/util/browser_distribution.h" 66 #include "chrome/installer/util/browser_distribution.h"
66 #include "components/google/core/browser/google_util.h" 67 #include "components/google/core/browser/google_util.h"
67 #include "components/prefs/pref_registry_simple.h" 68 #include "components/prefs/pref_registry_simple.h"
68 #include "components/prefs/pref_service.h" 69 #include "components/prefs/pref_service.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // URL, otherwise we will look in the current directory for a file named 515 // 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. 516 // 'about' if the browser was started with a about:foo argument.
516 if (!url.is_valid()) { 517 if (!url.is_valid()) {
517 base::ThreadRestrictions::ScopedAllowIO allow_io; 518 base::ThreadRestrictions::ScopedAllowIO allow_io;
518 url = url_formatter::FixupRelativeFile(cur_dir, param); 519 url = url_formatter::FixupRelativeFile(cur_dir, param);
519 } 520 }
520 // Exclude dangerous schemes. 521 // Exclude dangerous schemes.
521 if (!url.is_valid()) 522 if (!url.is_valid())
522 continue; 523 continue;
523 524
525 const GURL settings_url = GURL(chrome::kChromeUISettingsURL);
526 bool url_points_to_an_approved_settings_page = false;
527 #if defined(OS_CHROMEOS)
528 // In ChromeOS, allow any settings page to be specified on the command line.
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 const GURL reset_settings_url_with_cct_hash = reset_settings_url.Resolve(
540 std::string("#") +
541 options::ResetProfileSettingsHandler::kCctResetSettingsHash);
542 url_points_to_an_approved_settings_page =
543 url_points_to_an_approved_settings_page ||
544 url == reset_settings_url_with_cct_hash;
545 #endif // defined(OS_WIN)
546 #endif // defined(OS_CHROMEOS)
547
524 ChildProcessSecurityPolicy* policy = 548 ChildProcessSecurityPolicy* policy =
525 ChildProcessSecurityPolicy::GetInstance(); 549 ChildProcessSecurityPolicy::GetInstance();
526 if (policy->IsWebSafeScheme(url.scheme()) || 550 if (policy->IsWebSafeScheme(url.scheme()) ||
527 url.SchemeIs(url::kFileScheme) || 551 url.SchemeIs(url::kFileScheme) ||
528 #if defined(OS_CHROMEOS) 552 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)) { 553 (url.spec().compare(url::kAboutBlankURL) == 0)) {
541 urls.push_back(url); 554 urls.push_back(url);
542 } 555 }
543 } 556 }
544 return urls; 557 return urls;
545 } 558 }
546 559
547 bool StartupBrowserCreator::ProcessCmdLineImpl( 560 bool StartupBrowserCreator::ProcessCmdLineImpl(
548 const base::CommandLine& command_line, 561 const base::CommandLine& command_line,
549 const base::FilePath& cur_dir, 562 const base::FilePath& cur_dir,
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (!entry->IsSigninRequired()) { 947 if (!entry->IsSigninRequired()) {
935 Profile* profile = profile_manager->GetProfile(entry->GetPath()); 948 Profile* profile = profile_manager->GetProfile(entry->GetPath());
936 if (profile) 949 if (profile)
937 return profile; 950 return profile;
938 } 951 }
939 } 952 }
940 953
941 return nullptr; 954 return nullptr;
942 } 955 }
943 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 956 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698