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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 } | 721 } |
722 | 722 |
723 base::string16 GetChromiumModelIdForProfile( | 723 base::string16 GetChromiumModelIdForProfile( |
724 const base::FilePath& profile_path) { | 724 const base::FilePath& profile_path) { |
725 return GetAppModelIdForProfile( | 725 return GetAppModelIdForProfile( |
726 ShellUtil::GetBrowserModelId(InstallUtil::IsPerUserInstall()), | 726 ShellUtil::GetBrowserModelId(InstallUtil::IsPerUserInstall()), |
727 profile_path); | 727 profile_path); |
728 } | 728 } |
729 | 729 |
730 void MigrateTaskbarPins() { | 730 void MigrateTaskbarPins() { |
731 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
732 return; | |
733 | |
734 // This needs to happen eventually (e.g. so that the appid is fixed and the | 731 // This needs to happen eventually (e.g. so that the appid is fixed and the |
735 // run-time Chrome icon is merged with the taskbar shortcut), but this is not | 732 // run-time Chrome icon is merged with the taskbar shortcut), but this is not |
736 // urgent and shouldn't delay Chrome startup. | 733 // urgent and shouldn't delay Chrome startup. |
737 static const int64_t kMigrateTaskbarPinsDelaySeconds = 15; | 734 static const int64_t kMigrateTaskbarPinsDelaySeconds = 15; |
738 BrowserThread::PostDelayedTask( | 735 BrowserThread::PostDelayedTask( |
739 BrowserThread::FILE, FROM_HERE, | 736 BrowserThread::FILE, FROM_HERE, |
740 base::Bind(&MigrateTaskbarPinsCallback), | 737 base::Bind(&MigrateTaskbarPinsCallback), |
741 base::TimeDelta::FromSeconds(kMigrateTaskbarPinsDelaySeconds)); | 738 base::TimeDelta::FromSeconds(kMigrateTaskbarPinsDelaySeconds)); |
742 } | 739 } |
743 | 740 |
744 void GetIsPinnedToTaskbarState( | 741 void GetIsPinnedToTaskbarState( |
745 const ConnectionErrorCallback& on_error_callback, | 742 const ConnectionErrorCallback& on_error_callback, |
746 const IsPinnedToTaskbarCallback& result_callback) { | 743 const IsPinnedToTaskbarCallback& result_callback) { |
747 IsPinnedToTaskbarHelper::GetState(on_error_callback, result_callback); | 744 IsPinnedToTaskbarHelper::GetState(on_error_callback, result_callback); |
748 } | 745 } |
749 | 746 |
750 int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe, | 747 int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe, |
751 const base::FilePath& path) { | 748 const base::FilePath& path) { |
752 DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); | |
753 | |
754 // Enumerate all pinned shortcuts in the given path directly. | 749 // Enumerate all pinned shortcuts in the given path directly. |
755 base::FileEnumerator shortcuts_enum( | 750 base::FileEnumerator shortcuts_enum( |
756 path, false, // not recursive | 751 path, false, // not recursive |
757 base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); | 752 base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); |
758 | 753 |
759 bool is_per_user_install = InstallUtil::IsPerUserInstall(); | 754 bool is_per_user_install = InstallUtil::IsPerUserInstall(); |
760 | 755 |
761 int shortcuts_migrated = 0; | 756 int shortcuts_migrated = 0; |
762 base::FilePath target_path; | 757 base::FilePath target_path; |
763 base::string16 arguments; | 758 base::string16 arguments; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 base::win::SHORTCUT_UPDATE_EXISTING)) { | 845 base::win::SHORTCUT_UPDATE_EXISTING)) { |
851 ++shortcuts_migrated; | 846 ++shortcuts_migrated; |
852 } | 847 } |
853 } | 848 } |
854 return shortcuts_migrated; | 849 return shortcuts_migrated; |
855 } | 850 } |
856 | 851 |
857 } // namespace win | 852 } // namespace win |
858 | 853 |
859 } // namespace shell_integration | 854 } // namespace shell_integration |
OLD | NEW |