| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())), | 354 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())), |
| 355 profile_path); | 355 profile_path); |
| 356 } | 356 } |
| 357 | 357 |
| 358 string16 ShellIntegration::GetAppListAppModelIdForProfile( | 358 string16 ShellIntegration::GetAppListAppModelIdForProfile( |
| 359 const base::FilePath& profile_path) { | 359 const base::FilePath& profile_path) { |
| 360 return ShellIntegration::GetAppModelIdForProfile( | 360 return ShellIntegration::GetAppModelIdForProfile( |
| 361 GetAppListAppName(), profile_path); | 361 GetAppListAppName(), profile_path); |
| 362 } | 362 } |
| 363 | 363 |
| 364 string16 ShellIntegration::GetChromiumIconLocation() { | |
| 365 // Determine the path to chrome.exe. If we can't determine what that is, | |
| 366 // we have bigger fish to fry... | |
| 367 base::FilePath chrome_exe; | |
| 368 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | |
| 369 NOTREACHED(); | |
| 370 return string16(); | |
| 371 } | |
| 372 | |
| 373 return ShellUtil::FormatIconLocation( | |
| 374 chrome_exe.value(), | |
| 375 BrowserDistribution::GetDistribution()->GetIconIndex()); | |
| 376 } | |
| 377 | |
| 378 void ShellIntegration::MigrateChromiumShortcuts() { | 364 void ShellIntegration::MigrateChromiumShortcuts() { |
| 379 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 365 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 380 return; | 366 return; |
| 381 | 367 |
| 382 // This needs to happen eventually (e.g. so that the appid is fixed and the | 368 // This needs to happen eventually (e.g. so that the appid is fixed and the |
| 383 // run-time Chrome icon is merged with the taskbar shortcut), but this is not | 369 // run-time Chrome icon is merged with the taskbar shortcut), but this is not |
| 384 // urgent and shouldn't delay Chrome startup. | 370 // urgent and shouldn't delay Chrome startup. |
| 385 static const int64 kMigrateChromiumShortcutsDelaySeconds = 15; | 371 static const int64 kMigrateChromiumShortcutsDelaySeconds = 15; |
| 386 BrowserThread::PostDelayedTask( | 372 BrowserThread::PostDelayedTask( |
| 387 BrowserThread::FILE, FROM_HERE, | 373 BrowserThread::FILE, FROM_HERE, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 return shortcuts_migrated; | 494 return shortcuts_migrated; |
| 509 } | 495 } |
| 510 | 496 |
| 511 base::FilePath ShellIntegration::GetStartMenuShortcut( | 497 base::FilePath ShellIntegration::GetStartMenuShortcut( |
| 512 const base::FilePath& chrome_exe) { | 498 const base::FilePath& chrome_exe) { |
| 513 static const int kFolderIds[] = { | 499 static const int kFolderIds[] = { |
| 514 base::DIR_COMMON_START_MENU, | 500 base::DIR_COMMON_START_MENU, |
| 515 base::DIR_START_MENU, | 501 base::DIR_START_MENU, |
| 516 }; | 502 }; |
| 517 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 503 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 518 string16 shortcut_name(dist->GetAppShortCutName()); | 504 string16 shortcut_name( |
| 505 dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME)); |
| 519 base::FilePath shortcut; | 506 base::FilePath shortcut; |
| 520 | 507 |
| 521 // Check both the common and the per-user Start Menu folders for system-level | 508 // Check both the common and the per-user Start Menu folders for system-level |
| 522 // installs. | 509 // installs. |
| 523 size_t folder = | 510 size_t folder = |
| 524 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()) ? 1 : 0; | 511 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()) ? 1 : 0; |
| 525 for (; folder < arraysize(kFolderIds); ++folder) { | 512 for (; folder < arraysize(kFolderIds); ++folder) { |
| 526 if (!PathService::Get(kFolderIds[folder], &shortcut)) { | 513 if (!PathService::Get(kFolderIds[folder], &shortcut)) { |
| 527 NOTREACHED(); | 514 NOTREACHED(); |
| 528 continue; | 515 continue; |
| 529 } | 516 } |
| 530 | 517 |
| 531 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + | 518 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + |
| 532 installer::kLnkExt); | 519 installer::kLnkExt); |
| 533 if (base::PathExists(shortcut)) | 520 if (base::PathExists(shortcut)) |
| 534 return shortcut; | 521 return shortcut; |
| 535 } | 522 } |
| 536 | 523 |
| 537 return base::FilePath(); | 524 return base::FilePath(); |
| 538 } | 525 } |
| OLD | NEW |