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

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

Issue 11299024: Revert 168080 - Configure system-level Chrome settings (i.e. install its shortcuts) immediately fol… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/uninstall.cc ('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) 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 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 bool delete_folder = (location == SHORTCUT_LOCATION_START_MENU); 1790 bool delete_folder = (location == SHORTCUT_LOCATION_START_MENU);
1791 1791
1792 FilePath shortcut_folder; 1792 FilePath shortcut_folder;
1793 if (!GetShortcutPath(location, dist, level, &shortcut_folder) || 1793 if (!GetShortcutPath(location, dist, level, &shortcut_folder) ||
1794 shortcut_folder.empty()) { 1794 shortcut_folder.empty()) {
1795 NOTREACHED(); 1795 NOTREACHED();
1796 return false; 1796 return false;
1797 } 1797 }
1798 1798
1799 string16 shortcut_base_name( 1799 string16 shortcut_base_name(
1800 (shortcut_name ? *shortcut_name : 1800 (shortcut_name ? *shortcut_name : dist->GetAppShortCutName()) +
1801 dist->GetAppShortCutName()) + installer::kLnkExt); 1801 installer::kLnkExt);
1802 FilePath shortcut_path(shortcut_folder.Append(shortcut_base_name)); 1802 FilePath shortcut_path(shortcut_folder.Append(shortcut_base_name));
1803 1803
1804 if (!file_util::PathExists(shortcut_path)) 1804 if (!file_util::PathExists(shortcut_path))
1805 return true; 1805 return true;
1806 1806
1807 FilePath read_target; 1807 base::win::ScopedComPtr<IShellLink> i_shell_link;
1808 if (!base::win::ResolveShortcut(shortcut_path, &read_target, NULL)) 1808 base::win::ScopedComPtr<IPersistFile> i_persist_file;
1809 wchar_t read_target[MAX_PATH] = {};
1810 if (FAILED(i_shell_link.CreateInstance(CLSID_ShellLink, NULL,
1811 CLSCTX_INPROC_SERVER)) ||
1812 FAILED(i_persist_file.QueryFrom(i_shell_link)) ||
1813 FAILED(i_persist_file->Load(shortcut_path.value().c_str(), STGM_READ)) ||
1814 FAILED(i_shell_link->GetPath(read_target, MAX_PATH, NULL,
1815 SLGP_SHORTPATH))) {
1816 NOTREACHED();
1809 return false; 1817 return false;
1818 }
1810 1819
1811 if (InstallUtil::ProgramCompare( 1820 if (InstallUtil::ProgramCompare(FilePath(target_exe)).Evaluate(read_target)) {
1812 FilePath(target_exe)).Evaluate(read_target.value())) {
1813 // Unpin the shortcut if it was ever pinned by the user or the installer. 1821 // Unpin the shortcut if it was ever pinned by the user or the installer.
1814 VLOG(1) << "Trying to unpin " << shortcut_path.value(); 1822 VLOG(1) << "Trying to unpin " << shortcut_path.value();
1815 if (!base::win::TaskbarUnpinShortcutLink(shortcut_path.value().c_str())) { 1823 if (!base::win::TaskbarUnpinShortcutLink(shortcut_path.value().c_str())) {
1816 VLOG(1) << shortcut_path.value() 1824 VLOG(1) << shortcut_path.value()
1817 << " wasn't pinned (or the unpin failed)."; 1825 << " wasn't pinned (or the unpin failed).";
1818 } 1826 }
1819 if (delete_folder) 1827 if (delete_folder)
1820 return file_util::Delete(shortcut_folder, true); 1828 return file_util::Delete(shortcut_folder, true);
1821 else 1829 else
1822 return file_util::Delete(shortcut_path, false); 1830 return file_util::Delete(shortcut_path, false);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 // are any left...). 1954 // are any left...).
1947 if (free_bits >= 8 && next_byte_index < size) { 1955 if (free_bits >= 8 && next_byte_index < size) {
1948 free_bits -= 8; 1956 free_bits -= 8;
1949 bit_stream += bytes[next_byte_index++] << free_bits; 1957 bit_stream += bytes[next_byte_index++] << free_bits;
1950 } 1958 }
1951 } 1959 }
1952 1960
1953 DCHECK_EQ(ret.length(), encoded_length); 1961 DCHECK_EQ(ret.length(), encoded_length);
1954 return ret; 1962 return ret;
1955 } 1963 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/uninstall.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698