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

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

Issue 10910209: Add new PathService paths for Windows' All Users Desktop and Quick Launch folders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust links to pass presubmit Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_paths_win.cc ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | 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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 if (!appended_name.empty()) { 1091 if (!appended_name.empty()) {
1092 shortcut->append(L" ("); 1092 shortcut->append(L" (");
1093 shortcut->append(appended_name); 1093 shortcut->append(appended_name);
1094 shortcut->append(L")"); 1094 shortcut->append(L")");
1095 } 1095 }
1096 shortcut->append(L".lnk"); 1096 shortcut->append(L".lnk");
1097 return true; 1097 return true;
1098 } 1098 }
1099 1099
1100 bool ShellUtil::GetDesktopPath(bool system_level, FilePath* path) { 1100 bool ShellUtil::GetDesktopPath(bool system_level, FilePath* path) {
1101 wchar_t desktop[MAX_PATH]; 1101 int dir_key = system_level ? base::DIR_COMMON_DESKTOP :
1102 int dir = system_level ? CSIDL_COMMON_DESKTOPDIRECTORY : 1102 base::DIR_USER_DESKTOP;
1103 CSIDL_DESKTOPDIRECTORY; 1103 return PathService::Get(dir_key, path);
1104 if (FAILED(SHGetFolderPath(NULL, dir, NULL, SHGFP_TYPE_CURRENT, desktop)))
1105 return false;
1106 *path = FilePath(desktop);
1107 return true;
1108 } 1104 }
1109 1105
1110 bool ShellUtil::GetQuickLaunchPath(bool system_level, FilePath* path) { 1106 bool ShellUtil::GetQuickLaunchPath(bool system_level, FilePath* path) {
1111 if (system_level) { 1107 int dir_key = system_level ? base::DIR_DEFAULT_USER_QUICK_LAUNCH :
1112 wchar_t qlaunch[MAX_PATH]; 1108 base::DIR_USER_QUICK_LAUNCH;
1113 // We are accessing GetDefaultUserProfileDirectory this way so that we do 1109 return PathService::Get(dir_key, path);
1114 // not have to declare dependency to Userenv.lib for chrome.exe
1115 typedef BOOL (WINAPI *PROFILE_FUNC)(LPWSTR, LPDWORD);
1116 HMODULE module = LoadLibrary(L"Userenv.dll");
1117 PROFILE_FUNC p = reinterpret_cast<PROFILE_FUNC>(GetProcAddress(module,
1118 "GetDefaultUserProfileDirectoryW"));
1119 DWORD size = _countof(qlaunch);
1120 if ((p == NULL) || ((p)(qlaunch, &size) != TRUE))
1121 return false;
1122 *path = FilePath(qlaunch);
1123 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
1124 *path = path->AppendASCII("AppData");
1125 *path = path->AppendASCII("Roaming");
1126 } else {
1127 *path = path->AppendASCII("Application Data");
1128 }
1129 } else {
1130 if (!PathService::Get(base::DIR_APP_DATA, path)) {
1131 return false;
1132 }
1133 }
1134 *path = path->AppendASCII("Microsoft");
1135 *path = path->AppendASCII("Internet Explorer");
1136 *path = path->AppendASCII("Quick Launch");
1137 return true;
1138 } 1110 }
1139 1111
1140 void ShellUtil::GetRegisteredBrowsers( 1112 void ShellUtil::GetRegisteredBrowsers(
1141 BrowserDistribution* dist, 1113 BrowserDistribution* dist,
1142 std::map<string16, string16>* browsers) { 1114 std::map<string16, string16>* browsers) {
1143 DCHECK(dist); 1115 DCHECK(dist);
1144 DCHECK(browsers); 1116 DCHECK(browsers);
1145 1117
1146 const string16 base_key(ShellUtil::kRegStartMenuInternet); 1118 const string16 base_key(ShellUtil::kRegStartMenuInternet);
1147 string16 client_path; 1119 string16 client_path;
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 // are any left...). 1716 // are any left...).
1745 if (free_bits >= 8 && next_byte_index < size) { 1717 if (free_bits >= 8 && next_byte_index < size) {
1746 free_bits -= 8; 1718 free_bits -= 8;
1747 bit_stream += bytes[next_byte_index++] << free_bits; 1719 bit_stream += bytes[next_byte_index++] << free_bits;
1748 } 1720 }
1749 } 1721 }
1750 1722
1751 DCHECK_EQ(ret.length(), encoded_length); 1723 DCHECK_EQ(ret.length(), encoded_length);
1752 return ret; 1724 return ret;
1753 } 1725 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths_win.cc ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698