Chromium Code Reviews| Index: chrome/browser/shell_integration_win.cc |
| diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc |
| index 246766fb23cee66a89d7b70537a9abd9d9b26dfc..17158ebe9c62c117e2fe39ec5ae8f86ef8e39464 100644 |
| --- a/chrome/browser/shell_integration_win.cc |
| +++ b/chrome/browser/shell_integration_win.cc |
| @@ -154,7 +154,7 @@ base::string16 GetExpectedAppId(const base::CommandLine& command_line, |
| return ShellIntegration::GetAppModelIdForProfile(app_name, profile_path); |
| } |
| -void MigrateChromiumShortcutsCallback() { |
| +void MigrateChromiumTaskbarPinsCallback() { |
| // This should run on the file thread. |
| DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| @@ -163,42 +163,13 @@ void MigrateChromiumShortcutsCallback() { |
| if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
| return; |
| - // Locations to check for shortcuts migration. |
| - static const struct { |
| - int location_id; |
| - const wchar_t* sub_dir; |
| - } kLocations[] = { |
| - { |
| - base::DIR_TASKBAR_PINS, |
| - NULL |
| - }, { |
| - base::DIR_USER_DESKTOP, |
| - NULL |
| - }, { |
| - base::DIR_START_MENU, |
| - NULL |
| - }, { |
| - base::DIR_APP_DATA, |
| - L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\StartMenu" |
| - } |
| - }; |
| - |
| - for (size_t i = 0; i < arraysize(kLocations); ++i) { |
| - base::FilePath path; |
| - if (!PathService::Get(kLocations[i].location_id, &path)) { |
| - NOTREACHED(); |
| - continue; |
| - } |
| - |
| - if (kLocations[i].sub_dir) |
| - path = path.Append(kLocations[i].sub_dir); |
| - |
| - // Clear |dual_mode| property from taskbar pins as those are user-level |
| - // shortcuts which aren't handled by the installer. |
| - bool clear_dual_mode = kLocations[i].location_id == base::DIR_TASKBAR_PINS; |
| - ShellIntegration::MigrateShortcutsInPathInternal(chrome_exe, path, |
| - clear_dual_mode); |
| + base::FilePath pins_path; |
| + if (!PathService::Get(base::DIR_TASKBAR_PINS, &pins_path)) { |
| + NOTREACHED(); |
| + return; |
| } |
| + |
| + ShellIntegration::MigrateShortcutsInPathInternal(chrome_exe, pins_path); |
| } |
| // Windows 8 introduced a new protocol->executable binding system which cannot |
| @@ -509,7 +480,7 @@ base::string16 ShellIntegration::GetAppListAppModelIdForProfile( |
| return GetAppModelIdForProfile(GetAppListAppName(), profile_path); |
| } |
| -void ShellIntegration::MigrateChromiumShortcuts() { |
| +void ShellIntegration::MigrateChromiumTaskbarPins() { |
| if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| return; |
| @@ -519,14 +490,13 @@ void ShellIntegration::MigrateChromiumShortcuts() { |
| static const int64_t kMigrateChromiumShortcutsDelaySeconds = 15; |
| BrowserThread::PostDelayedTask( |
| BrowserThread::FILE, FROM_HERE, |
| - base::Bind(&MigrateChromiumShortcutsCallback), |
| + base::Bind(&MigrateChromiumTaskbarPinsCallback), |
| base::TimeDelta::FromSeconds(kMigrateChromiumShortcutsDelaySeconds)); |
| } |
| int ShellIntegration::MigrateShortcutsInPathInternal( |
| const base::FilePath& chrome_exe, |
| - const base::FilePath& path, |
| - bool clear_dual_mode) { |
| + const base::FilePath& path) { |
| DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); |
| // Enumerate all pinned shortcuts in the given path directly. |
| @@ -599,12 +569,13 @@ int ShellIntegration::MigrateShortcutsInPathInternal( |
| } |
| } |
| - // Clear |dual_mode| property from any shortcuts that previously had it (as |
| - // requested by caller). |
| + // Clear dual_mode property from any shortcuts that previously had it (it |
| + // was only ever installed on shortcuts with the |
| + // |default_chromium_model_id|. |
|
grt (UTC plus 2)
2016/01/14 19:51:12
nit: close paren before terminating period
gab
2016/01/15 02:27:22
Done.
|
| BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| base::string16 default_chromium_model_id( |
| ShellUtil::GetBrowserModelId(dist, is_per_user_install)); |
| - if (clear_dual_mode && expected_app_id == default_chromium_model_id) { |
| + if (expected_app_id == default_chromium_model_id) { |
| propvariant.Reset(); |
| if (property_store->GetValue(PKEY_AppUserModel_IsDualMode, |
| propvariant.Receive()) != S_OK) { |