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