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

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

Powered by Google App Engine
This is Rietveld 408576698