Chromium Code Reviews| 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 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())), | 350 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())), |
| 351 profile_path); | 351 profile_path); |
| 352 } | 352 } |
| 353 | 353 |
| 354 string16 ShellIntegration::GetAppListAppModelIdForProfile( | 354 string16 ShellIntegration::GetAppListAppModelIdForProfile( |
| 355 const base::FilePath& profile_path) { | 355 const base::FilePath& profile_path) { |
| 356 return ShellIntegration::GetAppModelIdForProfile( | 356 return ShellIntegration::GetAppModelIdForProfile( |
| 357 GetAppListAppName(), profile_path); | 357 GetAppListAppName(), profile_path); |
| 358 } | 358 } |
| 359 | 359 |
| 360 string16 ShellIntegration::GetChromiumIconLocation() { | 360 string16 ShellIntegration::GetChromiumIconLocation() { |
|
gab
2013/05/18 23:57:22
Looks like this method is no longer used.
calamity
2013/05/24 02:03:11
Removed.
| |
| 361 // Determine the path to chrome.exe. If we can't determine what that is, | 361 // Determine the path to chrome.exe. If we can't determine what that is, |
| 362 // we have bigger fish to fry... | 362 // we have bigger fish to fry... |
| 363 base::FilePath chrome_exe; | 363 base::FilePath chrome_exe; |
| 364 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | 364 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 365 NOTREACHED(); | 365 NOTREACHED(); |
| 366 return string16(); | 366 return string16(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 return ShellUtil::FormatIconLocation( | 369 return ShellUtil::FormatIconLocation( |
| 370 chrome_exe.value(), | 370 chrome_exe.value(), |
| 371 BrowserDistribution::GetDistribution()->GetIconIndex()); | 371 BrowserDistribution::GetDistribution()-> |
| 372 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index); | |
| 372 } | 373 } |
| 373 | 374 |
| 374 void ShellIntegration::MigrateChromiumShortcuts() { | 375 void ShellIntegration::MigrateChromiumShortcuts() { |
| 375 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 376 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 376 return; | 377 return; |
| 377 | 378 |
| 378 // This needs to happen eventually (e.g. so that the appid is fixed and the | 379 // This needs to happen eventually (e.g. so that the appid is fixed and the |
| 379 // run-time Chrome icon is merged with the taskbar shortcut), but this is not | 380 // run-time Chrome icon is merged with the taskbar shortcut), but this is not |
| 380 // urgent and shouldn't delay Chrome startup. | 381 // urgent and shouldn't delay Chrome startup. |
| 381 static const int64 kMigrateChromiumShortcutsDelaySeconds = 15; | 382 static const int64 kMigrateChromiumShortcutsDelaySeconds = 15; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 return shortcuts_migrated; | 505 return shortcuts_migrated; |
| 505 } | 506 } |
| 506 | 507 |
| 507 base::FilePath ShellIntegration::GetStartMenuShortcut( | 508 base::FilePath ShellIntegration::GetStartMenuShortcut( |
| 508 const base::FilePath& chrome_exe) { | 509 const base::FilePath& chrome_exe) { |
| 509 static const int kFolderIds[] = { | 510 static const int kFolderIds[] = { |
| 510 base::DIR_COMMON_START_MENU, | 511 base::DIR_COMMON_START_MENU, |
| 511 base::DIR_START_MENU, | 512 base::DIR_START_MENU, |
| 512 }; | 513 }; |
| 513 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 514 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 514 string16 shortcut_name(dist->GetAppShortCutName()); | 515 string16 shortcut_name( |
| 516 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name); | |
| 515 base::FilePath shortcut; | 517 base::FilePath shortcut; |
| 516 | 518 |
| 517 // Check both the common and the per-user Start Menu folders for system-level | 519 // Check both the common and the per-user Start Menu folders for system-level |
| 518 // installs. | 520 // installs. |
| 519 size_t folder = | 521 size_t folder = |
| 520 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()) ? 1 : 0; | 522 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()) ? 1 : 0; |
| 521 for (; folder < arraysize(kFolderIds); ++folder) { | 523 for (; folder < arraysize(kFolderIds); ++folder) { |
| 522 if (!PathService::Get(kFolderIds[folder], &shortcut)) { | 524 if (!PathService::Get(kFolderIds[folder], &shortcut)) { |
| 523 NOTREACHED(); | 525 NOTREACHED(); |
| 524 continue; | 526 continue; |
| 525 } | 527 } |
| 526 | 528 |
| 527 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + | 529 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + |
| 528 installer::kLnkExt); | 530 installer::kLnkExt); |
| 529 if (file_util::PathExists(shortcut)) | 531 if (file_util::PathExists(shortcut)) |
| 530 return shortcut; | 532 return shortcut; |
| 531 } | 533 } |
| 532 | 534 |
| 533 return base::FilePath(); | 535 return base::FilePath(); |
| 534 } | 536 } |
| OLD | NEW |