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 <shlwapi.h> | 8 #include <shlwapi.h> |
9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
10 #include <propkey.h> // Needs to come after shobjidl.h. | 10 #include <propkey.h> // Needs to come after shobjidl.h. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 size_t folder = InstallUtil::IsPerUserInstall(chrome_exe) ? 1 : 0; | 617 size_t folder = InstallUtil::IsPerUserInstall(chrome_exe) ? 1 : 0; |
618 for (; folder < arraysize(kFolderIds); ++folder) { | 618 for (; folder < arraysize(kFolderIds); ++folder) { |
619 if (!PathService::Get(kFolderIds[folder], &programs_folder)) { | 619 if (!PathService::Get(kFolderIds[folder], &programs_folder)) { |
620 NOTREACHED(); | 620 NOTREACHED(); |
621 continue; | 621 continue; |
622 } | 622 } |
623 | 623 |
624 shortcut = programs_folder.Append(shortcut_name); | 624 shortcut = programs_folder.Append(shortcut_name); |
625 if (base::PathExists(shortcut)) | 625 if (base::PathExists(shortcut)) |
626 return shortcut; | 626 return shortcut; |
627 | |
628 // Check in "Start Menu\Programs\<BROWSER>" if the shortcut was not found in | |
629 // "Start Menu\Programs". This fallback check is here to handle running | |
630 // instances that are updated past the change that migrates Chrome's start | |
631 // menu shortcut from the "Google Chrome" folder up into the main "Programs" | |
632 // folder. This code will become obsolete when the migration change lands, | |
633 // and is to be removed in that change. | |
634 shortcut = | |
635 programs_folder.Append(dist->GetStartMenuShortcutSubfolder( | |
636 BrowserDistribution::SUBFOLDER_CHROME)) | |
637 .Append(shortcut_name); | |
638 if (base::PathExists(shortcut)) | |
639 return shortcut; | |
640 } | 627 } |
641 | 628 |
642 return base::FilePath(); | 629 return base::FilePath(); |
643 } | 630 } |
644 | 631 |
645 // static | 632 // static |
646 bool ShellIntegration::DefaultWebClientWorker::ShouldReportAttemptResults() { | 633 bool ShellIntegration::DefaultWebClientWorker::ShouldReportAttemptResults() { |
647 return base::win::GetVersion() >= base::win::VERSION_WIN10 && | 634 return base::win::GetVersion() >= base::win::VERSION_WIN10 && |
648 IsSetAsDefaultAsynchronous(); | 635 IsSetAsDefaultAsynchronous(); |
649 } | 636 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // in the "How would you like to open this?" prompt. | 691 // in the "How would you like to open this?" prompt. |
705 if (!RegisterBrowser()) | 692 if (!RegisterBrowser()) |
706 return false; | 693 return false; |
707 | 694 |
708 ResetDefaultBrowser(); | 695 ResetDefaultBrowser(); |
709 | 696 |
710 base::CommandLine cmdline(base::FilePath(L"openwith.exe")); | 697 base::CommandLine cmdline(base::FilePath(L"openwith.exe")); |
711 cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl()); | 698 cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl()); |
712 return base::LaunchProcess(cmdline, base::LaunchOptions()).IsValid(); | 699 return base::LaunchProcess(cmdline, base::LaunchOptions()).IsValid(); |
713 } | 700 } |
OLD | NEW |