Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1281)

Unified Diff: chrome/browser/shell_integration_win.cc

Issue 1588733005: Reduce MigrateChromiumShortcuts to only handling taskbar pins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2_gab_more_metro_cleanup
Patch Set: review:grt Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/shell_integration_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c43b35efa2b53904b407341f718fa3b8dbf8cb95 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 MigrateTaskbarPinsCallback() {
// 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,24 +480,23 @@ base::string16 ShellIntegration::GetAppListAppModelIdForProfile(
return GetAppModelIdForProfile(GetAppListAppName(), profile_path);
}
-void ShellIntegration::MigrateChromiumShortcuts() {
+void ShellIntegration::MigrateTaskbarPins() {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return;
// This needs to happen eventually (e.g. so that the appid is fixed and the
// run-time Chrome icon is merged with the taskbar shortcut), but this is not
// urgent and shouldn't delay Chrome startup.
- static const int64_t kMigrateChromiumShortcutsDelaySeconds = 15;
+ static const int64_t kMigrateTaskbarPinsDelaySeconds = 15;
BrowserThread::PostDelayedTask(
BrowserThread::FILE, FROM_HERE,
- base::Bind(&MigrateChromiumShortcutsCallback),
- base::TimeDelta::FromSeconds(kMigrateChromiumShortcutsDelaySeconds));
+ base::Bind(&MigrateTaskbarPinsCallback),
+ base::TimeDelta::FromSeconds(kMigrateTaskbarPinsDelaySeconds));
}
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|).
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) {
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/shell_integration_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698