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

Side by Side Diff: chrome/browser/shell_integration_win.cc

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

Powered by Google App Engine
This is Rietveld 408576698