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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 174194: Re-apply r23841 "During uninstall if Chrome is set as default" (Closed)
Patch Set: update for combobox model changes Created 11 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
« no previous file with comments | « chrome/installer/util/shell_util.h ('k') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } else { 576 } else {
577 if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 577 if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL,
578 SHGFP_TYPE_CURRENT, qlaunch))) 578 SHGFP_TYPE_CURRENT, qlaunch)))
579 return false; 579 return false;
580 *path = qlaunch; 580 *path = qlaunch;
581 } 581 }
582 file_util::AppendToPath(path, kQuickLaunchPath); 582 file_util::AppendToPath(path, kQuickLaunchPath);
583 return true; 583 return true;
584 } 584 }
585 585
586 void ShellUtil::GetRegisteredBrowsers(std::map<std::wstring,
587 std::wstring>* browsers) {
588 std::wstring base_key(ShellUtil::kRegStartMenuInternet);
589 HKEY root = HKEY_LOCAL_MACHINE;
590 for (RegistryKeyIterator iter(root, base_key.c_str()); iter.Valid(); ++iter) {
591 std::wstring key = base_key + L"\\" + iter.Name();
592 RegKey capabilities(root, (key + L"\\Capabilities").c_str());
593 std::wstring name;
594 if (!capabilities.Valid() ||
595 !capabilities.ReadValue(L"ApplicationName", &name)) {
596 RegKey base_key(root, key.c_str());
597 if (!base_key.ReadValue(L"", &name))
598 continue;
599 }
600 RegKey install_info(root, (key + L"\\InstallInfo").c_str());
601 std::wstring command;
602 if (!install_info.Valid() ||
603 !install_info.ReadValue(L"ReinstallCommand", &command))
604 continue;
605 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
606 if (!name.empty() && !command.empty() &&
607 name.find(dist->GetApplicationName()) == std::wstring::npos)
608 (*browsers)[name] = command;
609 }
610 }
611
586 bool ShellUtil::GetUserSpecificDefaultBrowserSuffix(std::wstring* entry) { 612 bool ShellUtil::GetUserSpecificDefaultBrowserSuffix(std::wstring* entry) {
587 wchar_t user_name[256]; 613 wchar_t user_name[256];
588 DWORD size = _countof(user_name); 614 DWORD size = _countof(user_name);
589 if (::GetUserName(user_name, &size) == 0) 615 if (::GetUserName(user_name, &size) == 0)
590 return false; 616 return false;
591 entry->assign(L"."); 617 entry->assign(L".");
592 entry->append(user_name); 618 entry->append(user_name);
593 619
594 std::wstring start_menu_entry(ShellUtil::kRegStartMenuInternet); 620 std::wstring start_menu_entry(ShellUtil::kRegStartMenuInternet);
595 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 621 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 } else { 806 } else {
781 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target 807 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target
782 shortcut.c_str(), // shortcut 808 shortcut.c_str(), // shortcut
783 chrome_path.c_str(), // working dir 809 chrome_path.c_str(), // working dir
784 NULL, // arguments 810 NULL, // arguments
785 description.c_str(), // description 811 description.c_str(), // description
786 chrome_exe.c_str(), // icon file 812 chrome_exe.c_str(), // icon file
787 0); // icon index 813 0); // icon index
788 } 814 }
789 } 815 }
OLDNEW
« no previous file with comments | « chrome/installer/util/shell_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698