| 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 // 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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 NOTREACHED() << dir_key; | 1721 NOTREACHED() << dir_key; |
| 1722 return false; | 1722 return false; |
| 1723 } | 1723 } |
| 1724 | 1724 |
| 1725 if (!folder_to_append.empty()) | 1725 if (!folder_to_append.empty()) |
| 1726 *path = path->Append(folder_to_append); | 1726 *path = path->Append(folder_to_append); |
| 1727 | 1727 |
| 1728 return true; | 1728 return true; |
| 1729 } | 1729 } |
| 1730 | 1730 |
| 1731 bool ShellUtil::MoveExistingShortcut( |
| 1732 ShellUtil::ShellChange shortcut_level, |
| 1733 BrowserDistribution* dist, |
| 1734 const ShellUtil::ShortcutProperties& properties, |
| 1735 ShellUtil::ShortcutLocation old_location, |
| 1736 ShellUtil::ShortcutLocation new_location) { |
| 1737 // Explicitly whitelist locations to which this is applicable. |
| 1738 if (old_location != SHORTCUT_LOCATION_START_MENU_CHROME_DIR || |
| 1739 new_location != SHORTCUT_LOCATION_START_MENU_ROOT) { |
| 1740 NOTREACHED(); |
| 1741 return false; |
| 1742 } |
| 1743 |
| 1744 base::string16 shortcut_name( |
| 1745 ExtractShortcutNameFromProperties(dist, properties)); |
| 1746 |
| 1747 base::FilePath old_shortcut_path; |
| 1748 base::FilePath new_shortcut_path; |
| 1749 ShellUtil::GetShortcutPath( |
| 1750 old_location, dist, shortcut_level, &old_shortcut_path); |
| 1751 ShellUtil::GetShortcutPath( |
| 1752 new_location, dist, shortcut_level, &new_shortcut_path); |
| 1753 old_shortcut_path = old_shortcut_path.Append(shortcut_name); |
| 1754 new_shortcut_path = new_shortcut_path.Append(shortcut_name); |
| 1755 |
| 1756 return !!::MoveFile(old_shortcut_path.value().c_str(), |
| 1757 new_shortcut_path.value().c_str()); |
| 1758 } |
| 1759 |
| 1731 bool ShellUtil::CreateOrUpdateShortcut( | 1760 bool ShellUtil::CreateOrUpdateShortcut( |
| 1732 ShellUtil::ShortcutLocation location, | 1761 ShellUtil::ShortcutLocation location, |
| 1733 BrowserDistribution* dist, | 1762 BrowserDistribution* dist, |
| 1734 const ShellUtil::ShortcutProperties& properties, | 1763 const ShellUtil::ShortcutProperties& properties, |
| 1735 ShellUtil::ShortcutOperation operation) { | 1764 ShellUtil::ShortcutOperation operation) { |
| 1736 // Explicitly whitelist locations to which this is applicable. | 1765 // Explicitly whitelist locations to which this is applicable. |
| 1737 if (location != SHORTCUT_LOCATION_DESKTOP && | 1766 if (location != SHORTCUT_LOCATION_DESKTOP && |
| 1738 location != SHORTCUT_LOCATION_QUICK_LAUNCH && | 1767 location != SHORTCUT_LOCATION_QUICK_LAUNCH && |
| 1739 location != SHORTCUT_LOCATION_START_MENU_ROOT && | 1768 location != SHORTCUT_LOCATION_START_MENU_ROOT && |
| 1740 location != SHORTCUT_LOCATION_START_MENU_CHROME_DIR && | 1769 location != SHORTCUT_LOCATION_START_MENU_CHROME_DIR && |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 base::string16 key_path(ShellUtil::kRegClasses); | 2594 base::string16 key_path(ShellUtil::kRegClasses); |
| 2566 key_path.push_back(base::FilePath::kSeparators[0]); | 2595 key_path.push_back(base::FilePath::kSeparators[0]); |
| 2567 key_path.append(prog_id); | 2596 key_path.append(prog_id); |
| 2568 return InstallUtil::DeleteRegistryKey( | 2597 return InstallUtil::DeleteRegistryKey( |
| 2569 HKEY_CURRENT_USER, key_path, WorkItem::kWow64Default); | 2598 HKEY_CURRENT_USER, key_path, WorkItem::kWow64Default); |
| 2570 | 2599 |
| 2571 // TODO(mgiuca): Remove the extension association entries. This requires that | 2600 // TODO(mgiuca): Remove the extension association entries. This requires that |
| 2572 // the extensions associated with a particular prog_id are stored in that | 2601 // the extensions associated with a particular prog_id are stored in that |
| 2573 // prog_id's key. | 2602 // prog_id's key. |
| 2574 } | 2603 } |
| OLD | NEW |