| 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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 bool ShortcutOpUnpin(const base::FilePath& shortcut_path) { | 1193 bool ShortcutOpUnpin(const base::FilePath& shortcut_path) { |
| 1194 VLOG(1) << "Trying to unpin " << shortcut_path.value(); | 1194 VLOG(1) << "Trying to unpin " << shortcut_path.value(); |
| 1195 if (!base::win::TaskbarUnpinShortcutLink(shortcut_path.value().c_str())) { | 1195 if (!base::win::TaskbarUnpinShortcutLink(shortcut_path.value().c_str())) { |
| 1196 VLOG(1) << shortcut_path.value() << " wasn't pinned (or the unpin failed)."; | 1196 VLOG(1) << shortcut_path.value() << " wasn't pinned (or the unpin failed)."; |
| 1197 // No error, since shortcut might not be pinned. | 1197 // No error, since shortcut might not be pinned. |
| 1198 } | 1198 } |
| 1199 return true; | 1199 return true; |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 bool ShortcutOpDelete(const base::FilePath& shortcut_path) { | 1202 bool ShortcutOpDelete(const base::FilePath& shortcut_path) { |
| 1203 bool ret = base::Delete(shortcut_path, false); | 1203 bool ret = base::DeleteFile(shortcut_path, false); |
| 1204 LOG_IF(ERROR, !ret) << "Failed to remove " << shortcut_path.value(); | 1204 LOG_IF(ERROR, !ret) << "Failed to remove " << shortcut_path.value(); |
| 1205 return ret; | 1205 return ret; |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 bool ShortcutOpUpdate(const base::win::ShortcutProperties& shortcut_properties, | 1208 bool ShortcutOpUpdate(const base::win::ShortcutProperties& shortcut_properties, |
| 1209 const base::FilePath& shortcut_path) { | 1209 const base::FilePath& shortcut_path) { |
| 1210 bool ret = base::win::CreateOrUpdateShortcutLink( | 1210 bool ret = base::win::CreateOrUpdateShortcutLink( |
| 1211 shortcut_path, shortcut_properties, base::win::SHORTCUT_REPLACE_EXISTING); | 1211 shortcut_path, shortcut_properties, base::win::SHORTCUT_REPLACE_EXISTING); |
| 1212 LOG_IF(ERROR, !ret) << "Failed to update " << shortcut_path.value(); | 1212 LOG_IF(ERROR, !ret) << "Failed to update " << shortcut_path.value(); |
| 1213 return ret; | 1213 return ret; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 location != ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS) { | 1262 location != ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS) { |
| 1263 NOTREACHED(); | 1263 NOTREACHED(); |
| 1264 return false; | 1264 return false; |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 base::FilePath shortcut_folder; | 1267 base::FilePath shortcut_folder; |
| 1268 if (!ShellUtil::GetShortcutPath(location, dist, level, &shortcut_folder)) { | 1268 if (!ShellUtil::GetShortcutPath(location, dist, level, &shortcut_folder)) { |
| 1269 LOG(WARNING) << "Cannot find path at location " << location; | 1269 LOG(WARNING) << "Cannot find path at location " << location; |
| 1270 return false; | 1270 return false; |
| 1271 } | 1271 } |
| 1272 if (!base::Delete(shortcut_folder, true)) { | 1272 if (!base::DeleteFile(shortcut_folder, true)) { |
| 1273 LOG(ERROR) << "Cannot remove folder " << shortcut_folder.value(); | 1273 LOG(ERROR) << "Cannot remove folder " << shortcut_folder.value(); |
| 1274 return false; | 1274 return false; |
| 1275 } | 1275 } |
| 1276 return true; | 1276 return true; |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 } // namespace | 1279 } // namespace |
| 1280 | 1280 |
| 1281 const wchar_t* ShellUtil::kRegDefaultIcon = L"\\DefaultIcon"; | 1281 const wchar_t* ShellUtil::kRegDefaultIcon = L"\\DefaultIcon"; |
| 1282 const wchar_t* ShellUtil::kRegShellPath = L"\\shell"; | 1282 const wchar_t* ShellUtil::kRegShellPath = L"\\shell"; |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 // are any left...). | 2081 // are any left...). |
| 2082 if (free_bits >= 8 && next_byte_index < size) { | 2082 if (free_bits >= 8 && next_byte_index < size) { |
| 2083 free_bits -= 8; | 2083 free_bits -= 8; |
| 2084 bit_stream += bytes[next_byte_index++] << free_bits; | 2084 bit_stream += bytes[next_byte_index++] << free_bits; |
| 2085 } | 2085 } |
| 2086 } | 2086 } |
| 2087 | 2087 |
| 2088 DCHECK_EQ(ret.length(), encoded_length); | 2088 DCHECK_EQ(ret.length(), encoded_length); |
| 2089 return ret; | 2089 return ret; |
| 2090 } | 2090 } |
| OLD | NEW |