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 #include "chrome/browser/shell_integration.h" | 5 #include "chrome/browser/shell_integration.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
9 #include <propkey.h> | 9 #include <propkey.h> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/files/file_enumerator.h" | |
15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
16 #include "base/path_service.h" | 15 #include "base/path_service.h" |
17 #include "base/string_util.h" | 16 #include "base/string_util.h" |
18 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
19 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
20 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
21 #include "base/win/registry.h" | 20 #include "base/win/registry.h" |
22 #include "base/win/scoped_comptr.h" | 21 #include "base/win/scoped_comptr.h" |
23 #include "base/win/scoped_propvariant.h" | 22 #include "base/win/scoped_propvariant.h" |
24 #include "base/win/shortcut.h" | 23 #include "base/win/shortcut.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 base::TimeDelta::FromSeconds(kMigrateChromiumShortcutsDelaySeconds)); | 385 base::TimeDelta::FromSeconds(kMigrateChromiumShortcutsDelaySeconds)); |
387 } | 386 } |
388 | 387 |
389 int ShellIntegration::MigrateShortcutsInPathInternal( | 388 int ShellIntegration::MigrateShortcutsInPathInternal( |
390 const base::FilePath& chrome_exe, | 389 const base::FilePath& chrome_exe, |
391 const base::FilePath& path, | 390 const base::FilePath& path, |
392 bool check_dual_mode) { | 391 bool check_dual_mode) { |
393 DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); | 392 DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); |
394 | 393 |
395 // Enumerate all pinned shortcuts in the given path directly. | 394 // Enumerate all pinned shortcuts in the given path directly. |
396 base::FileEnumerator shortcuts_enum( | 395 file_util::FileEnumerator shortcuts_enum( |
397 path, false, // not recursive | 396 path, false, // not recursive |
398 base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); | 397 file_util::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); |
399 | 398 |
400 bool is_per_user_install = | 399 bool is_per_user_install = |
401 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()); | 400 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()); |
402 | 401 |
403 int shortcuts_migrated = 0; | 402 int shortcuts_migrated = 0; |
404 base::FilePath target_path; | 403 base::FilePath target_path; |
405 string16 arguments; | 404 string16 arguments; |
406 base::win::ScopedPropVariant propvariant; | 405 base::win::ScopedPropVariant propvariant; |
407 for (base::FilePath shortcut = shortcuts_enum.Next(); !shortcut.empty(); | 406 for (base::FilePath shortcut = shortcuts_enum.Next(); !shortcut.empty(); |
408 shortcut = shortcuts_enum.Next()) { | 407 shortcut = shortcuts_enum.Next()) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 525 } |
527 | 526 |
528 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + | 527 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + |
529 installer::kLnkExt); | 528 installer::kLnkExt); |
530 if (file_util::PathExists(shortcut)) | 529 if (file_util::PathExists(shortcut)) |
531 return shortcut; | 530 return shortcut; |
532 } | 531 } |
533 | 532 |
534 return base::FilePath(); | 533 return base::FilePath(); |
535 } | 534 } |
OLD | NEW |