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_win.h" | 5 #include "chrome/browser/shell_integration_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <objbase.h> | 8 #include <objbase.h> |
9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 } | 739 } |
740 | 740 |
741 base::string16 GetChromiumModelIdForProfile( | 741 base::string16 GetChromiumModelIdForProfile( |
742 const base::FilePath& profile_path) { | 742 const base::FilePath& profile_path) { |
743 return GetAppModelIdForProfile( | 743 return GetAppModelIdForProfile( |
744 ShellUtil::GetBrowserModelId(InstallUtil::IsPerUserInstall()), | 744 ShellUtil::GetBrowserModelId(InstallUtil::IsPerUserInstall()), |
745 profile_path); | 745 profile_path); |
746 } | 746 } |
747 | 747 |
748 void MigrateTaskbarPins() { | 748 void MigrateTaskbarPins() { |
749 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
750 return; | |
751 | |
752 // This needs to happen (e.g. so that the appid is fixed and the | 749 // This needs to happen (e.g. so that the appid is fixed and the |
753 // run-time Chrome icon is merged with the taskbar shortcut), but it is not an | 750 // run-time Chrome icon is merged with the taskbar shortcut), but it is not an |
754 // urgent task. | 751 // urgent task. |
755 base::PostTaskWithTraits(FROM_HERE, | 752 base::PostTaskWithTraits(FROM_HERE, |
756 {base::MayBlock(), base::TaskPriority::BACKGROUND}, | 753 {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
757 base::Bind(&MigrateTaskbarPinsCallback)); | 754 base::Bind(&MigrateTaskbarPinsCallback)); |
758 } | 755 } |
759 | 756 |
760 void GetIsPinnedToTaskbarState( | 757 void GetIsPinnedToTaskbarState( |
761 const ConnectionErrorCallback& on_error_callback, | 758 const ConnectionErrorCallback& on_error_callback, |
762 const IsPinnedToTaskbarCallback& result_callback) { | 759 const IsPinnedToTaskbarCallback& result_callback) { |
763 IsPinnedToTaskbarHelper::GetState(on_error_callback, result_callback); | 760 IsPinnedToTaskbarHelper::GetState(on_error_callback, result_callback); |
764 } | 761 } |
765 | 762 |
766 int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe, | 763 int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe, |
767 const base::FilePath& path) { | 764 const base::FilePath& path) { |
768 DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); | |
769 | |
770 // Enumerate all pinned shortcuts in the given path directly. | 765 // Enumerate all pinned shortcuts in the given path directly. |
771 base::FileEnumerator shortcuts_enum( | 766 base::FileEnumerator shortcuts_enum( |
772 path, false, // not recursive | 767 path, false, // not recursive |
773 base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); | 768 base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); |
774 | 769 |
775 bool is_per_user_install = InstallUtil::IsPerUserInstall(); | 770 bool is_per_user_install = InstallUtil::IsPerUserInstall(); |
776 | 771 |
777 int shortcuts_migrated = 0; | 772 int shortcuts_migrated = 0; |
778 base::FilePath target_path; | 773 base::FilePath target_path; |
779 base::string16 arguments; | 774 base::string16 arguments; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 base::win::SHORTCUT_UPDATE_EXISTING)) { | 861 base::win::SHORTCUT_UPDATE_EXISTING)) { |
867 ++shortcuts_migrated; | 862 ++shortcuts_migrated; |
868 } | 863 } |
869 } | 864 } |
870 return shortcuts_migrated; | 865 return shortcuts_migrated; |
871 } | 866 } |
872 | 867 |
873 } // namespace win | 868 } // namespace win |
874 | 869 |
875 } // namespace shell_integration | 870 } // namespace shell_integration |
OLD | NEW |