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" |
11 | 11 |
12 #include <windows.h> | 12 #include <windows.h> |
13 #include <shlobj.h> | 13 #include <shlobj.h> |
14 | 14 |
15 #include <limits> | 15 #include <limits> |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "base/bind.h" | 18 #include "base/bind.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "base/file_util.h" | 20 #include "base/file_util.h" |
21 #include "base/files/file_enumerator.h" | |
22 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
23 #include "base/lazy_instance.h" | 22 #include "base/lazy_instance.h" |
24 #include "base/logging.h" | 23 #include "base/logging.h" |
25 #include "base/md5.h" | 24 #include "base/md5.h" |
26 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
27 #include "base/memory/scoped_vector.h" | 26 #include "base/memory/scoped_vector.h" |
28 #include "base/path_service.h" | 27 #include "base/path_service.h" |
29 #include "base/string16.h" | 28 #include "base/string16.h" |
30 #include "base/string_util.h" | 29 #include "base/string_util.h" |
31 #include "base/strings/string_number_conversions.h" | 30 #include "base/strings/string_number_conversions.h" |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 const base::FilePath& target_exe) { | 1224 const base::FilePath& target_exe) { |
1226 DCHECK(!shortcut_operation.is_null()); | 1225 DCHECK(!shortcut_operation.is_null()); |
1227 base::FilePath shortcut_folder; | 1226 base::FilePath shortcut_folder; |
1228 if (!ShellUtil::GetShortcutPath(location, dist, level, &shortcut_folder)) { | 1227 if (!ShellUtil::GetShortcutPath(location, dist, level, &shortcut_folder)) { |
1229 LOG(WARNING) << "Cannot find path at location " << location; | 1228 LOG(WARNING) << "Cannot find path at location " << location; |
1230 return false; | 1229 return false; |
1231 } | 1230 } |
1232 | 1231 |
1233 bool success = true; | 1232 bool success = true; |
1234 InstallUtil::ProgramCompare target_compare(target_exe); | 1233 InstallUtil::ProgramCompare target_compare(target_exe); |
1235 base::FileEnumerator enumerator( | 1234 file_util::FileEnumerator enumerator( |
1236 shortcut_folder, false, base::FileEnumerator::FILES, | 1235 shortcut_folder, false, file_util::FileEnumerator::FILES, |
1237 string16(L"*") + installer::kLnkExt); | 1236 string16(L"*") + installer::kLnkExt); |
1238 base::FilePath target_path; | 1237 base::FilePath target_path; |
1239 for (base::FilePath shortcut_path = enumerator.Next(); | 1238 for (base::FilePath shortcut_path = enumerator.Next(); |
1240 !shortcut_path.empty(); | 1239 !shortcut_path.empty(); |
1241 shortcut_path = enumerator.Next()) { | 1240 shortcut_path = enumerator.Next()) { |
1242 if (base::win::ResolveShortcut(shortcut_path, &target_path, NULL)) { | 1241 if (base::win::ResolveShortcut(shortcut_path, &target_path, NULL)) { |
1243 if (target_compare.EvaluatePath(target_path) && | 1242 if (target_compare.EvaluatePath(target_path) && |
1244 !shortcut_operation.Run(shortcut_path)) { | 1243 !shortcut_operation.Run(shortcut_path)) { |
1245 success = false; | 1244 success = false; |
1246 } | 1245 } |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 // are any left...). | 2080 // are any left...). |
2082 if (free_bits >= 8 && next_byte_index < size) { | 2081 if (free_bits >= 8 && next_byte_index < size) { |
2083 free_bits -= 8; | 2082 free_bits -= 8; |
2084 bit_stream += bytes[next_byte_index++] << free_bits; | 2083 bit_stream += bytes[next_byte_index++] << free_bits; |
2085 } | 2084 } |
2086 } | 2085 } |
2087 | 2086 |
2088 DCHECK_EQ(ret.length(), encoded_length); | 2087 DCHECK_EQ(ret.length(), encoded_length); |
2089 return ret; | 2088 return ret; |
2090 } | 2089 } |
OLD | NEW |