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

Side by Side Diff: chrome/installer/setup/install.cc

Issue 1315233005: Revert "Reset the default browser choice on windows 10 on install" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/installer/setup/install.h" 5 #include "chrome/installer/setup/install.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "chrome/installer/util/google_update_constants.h" 34 #include "chrome/installer/util/google_update_constants.h"
35 #include "chrome/installer/util/helper.h" 35 #include "chrome/installer/util/helper.h"
36 #include "chrome/installer/util/install_util.h" 36 #include "chrome/installer/util/install_util.h"
37 #include "chrome/installer/util/master_preferences.h" 37 #include "chrome/installer/util/master_preferences.h"
38 #include "chrome/installer/util/master_preferences_constants.h" 38 #include "chrome/installer/util/master_preferences_constants.h"
39 #include "chrome/installer/util/set_reg_value_work_item.h" 39 #include "chrome/installer/util/set_reg_value_work_item.h"
40 #include "chrome/installer/util/util_constants.h" 40 #include "chrome/installer/util/util_constants.h"
41 #include "chrome/installer/util/work_item.h" 41 #include "chrome/installer/util/work_item.h"
42 #include "chrome/installer/util/work_item_list.h" 42 #include "chrome/installer/util/work_item_list.h"
43 43
44
44 namespace { 45 namespace {
45 46
46 void LogShortcutOperation(ShellUtil::ShortcutLocation location, 47 void LogShortcutOperation(ShellUtil::ShortcutLocation location,
47 BrowserDistribution* dist, 48 BrowserDistribution* dist,
48 const ShellUtil::ShortcutProperties& properties, 49 const ShellUtil::ShortcutProperties& properties,
49 ShellUtil::ShortcutOperation operation, 50 ShellUtil::ShortcutOperation operation,
50 bool failed) { 51 bool failed) {
51 // ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING should not be used at install and 52 // ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING should not be used at install and
52 // thus this method does not handle logging a message for it. 53 // thus this method does not handle logging a message for it.
53 DCHECK(operation != ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING); 54 DCHECK(operation != ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return installer::NEW_VERSION_UPDATED; 244 return installer::NEW_VERSION_UPDATED;
244 } 245 }
245 246
246 LOG(ERROR) << "Not sure how we got here while updating" 247 LOG(ERROR) << "Not sure how we got here while updating"
247 << ", new version: " << new_version.GetString() 248 << ", new version: " << new_version.GetString()
248 << ", old version: " << (*current_version)->GetString(); 249 << ", old version: " << (*current_version)->GetString();
249 250
250 return installer::INSTALL_FAILED; 251 return installer::INSTALL_FAILED;
251 } 252 }
252 253
253 bool CanResetDefaultBrowserIntentPicker() {
254 return base::win::GetVersion() >= base::win::VERSION_WIN10;
255 }
256
257 void ResetDefaultBrowserIntentPicker() {
258 static const wchar_t kUrlAssociationKeyFormat[] =
259 L"SOFTWARE\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\"
260 L"%ls\\UserChoice";
261
262 if (ShellUtil::GetChromeDefaultState() != ShellUtil::IS_DEFAULT) {
263 const base::string16 hash_value_name(L"Hash");
264 InstallUtil::DeleteRegistryValue(
265 HKEY_CURRENT_USER,
266 base::StringPrintf(kUrlAssociationKeyFormat, L"http"), 0,
267 hash_value_name);
268 InstallUtil::DeleteRegistryValue(
269 HKEY_CURRENT_USER,
270 base::StringPrintf(kUrlAssociationKeyFormat, L"https"), 0,
271 hash_value_name);
272 }
273 }
274
275 } // end namespace 254 } // end namespace
276 255
277 namespace installer { 256 namespace installer {
278 257
279 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { 258 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) {
280 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"), 259 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"),
281 base::ASCIIToUTF16("&amp;"), att_value); 260 base::ASCIIToUTF16("&amp;"), att_value);
282 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"), 261 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"),
283 base::ASCIIToUTF16("&apos;"), att_value); 262 base::ASCIIToUTF16("&apos;"), att_value);
284 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"), 263 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"),
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 const base::FilePath chrome_exe( 455 const base::FilePath chrome_exe(
477 installer_state.target_path().Append(installer::kChromeExe)); 456 installer_state.target_path().Append(installer::kChromeExe));
478 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); 457 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value();
479 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) { 458 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) {
480 int level = ShellUtil::CURRENT_USER; 459 int level = ShellUtil::CURRENT_USER;
481 if (installer_state.system_install()) 460 if (installer_state.system_install())
482 level = level | ShellUtil::SYSTEM_LEVEL; 461 level = level | ShellUtil::SYSTEM_LEVEL;
483 ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true); 462 ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true);
484 } else { 463 } else {
485 ShellUtil::RegisterChromeBrowser(dist, chrome_exe, base::string16(), false); 464 ShellUtil::RegisterChromeBrowser(dist, chrome_exe, base::string16(), false);
486 if (make_chrome_default && CanResetDefaultBrowserIntentPicker())
487 ResetDefaultBrowserIntentPicker();
488 } 465 }
489 } 466 }
490 467
491 InstallStatus InstallOrUpdateProduct( 468 InstallStatus InstallOrUpdateProduct(
492 const installer::InstallationState& original_state, 469 const installer::InstallationState& original_state,
493 const installer::InstallerState& installer_state, 470 const installer::InstallerState& installer_state,
494 const base::FilePath& setup_path, 471 const base::FilePath& setup_path,
495 const base::FilePath& archive_path, 472 const base::FilePath& archive_path,
496 const base::FilePath& install_temp_path, 473 const base::FilePath& install_temp_path,
497 const base::FilePath& src_path, 474 const base::FilePath& src_path,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // Read master_preferences copied beside chrome.exe at install. 683 // Read master_preferences copied beside chrome.exe at install.
707 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 684 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
708 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 685 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
709 CreateOrUpdateShortcuts( 686 CreateOrUpdateShortcuts(
710 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 687 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
711 688
712 UpdateDefaultBrowserBeaconForPath(chrome_exe); 689 UpdateDefaultBrowserBeaconForPath(chrome_exe);
713 } 690 }
714 691
715 } // namespace installer 692 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698