| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 programs_folder.Append(dist->GetStartMenuShortcutSubfolder( | 658 programs_folder.Append(dist->GetStartMenuShortcutSubfolder( |
| 659 BrowserDistribution::SUBFOLDER_CHROME)) | 659 BrowserDistribution::SUBFOLDER_CHROME)) |
| 660 .Append(shortcut_name); | 660 .Append(shortcut_name); |
| 661 if (base::PathExists(shortcut)) | 661 if (base::PathExists(shortcut)) |
| 662 return shortcut; | 662 return shortcut; |
| 663 } | 663 } |
| 664 | 664 |
| 665 return base::FilePath(); | 665 return base::FilePath(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 // static | |
| 669 bool ShellIntegration::DefaultWebClientWorker::ShouldReportAttemptResults() { | |
| 670 return base::win::GetVersion() >= base::win::VERSION_WIN10 && | |
| 671 IsSetAsDefaultAsynchronous(); | |
| 672 } | |
| 673 | |
| 674 bool ShellIntegration::DefaultBrowserWorker::InitializeSetAsDefault() { | 668 bool ShellIntegration::DefaultBrowserWorker::InitializeSetAsDefault() { |
| 675 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 669 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 676 | 670 |
| 677 if (!IsSetAsDefaultAsynchronous()) | 671 if (!IsSetAsDefaultAsynchronous()) |
| 678 return false; | 672 return false; |
| 679 | 673 |
| 680 // On Windows 10+, there is no official way to prompt the user to set a | 674 // On Windows 10+, there is no official way to prompt the user to set a |
| 681 // default browser. This is the workaround: | 675 // default browser. This is the workaround: |
| 682 // 1. Unregister the default browser. | 676 // 1. Unregister the default browser. |
| 683 // 2. Open "How to make Chrome my default browser" link with openwith.exe. | 677 // 2. Open "How to make Chrome my default browser" link with openwith.exe. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 // in the "How would you like to open this?" prompt. | 729 // in the "How would you like to open this?" prompt. |
| 736 if (!RegisterBrowser()) | 730 if (!RegisterBrowser()) |
| 737 return false; | 731 return false; |
| 738 | 732 |
| 739 ResetDefaultBrowser(); | 733 ResetDefaultBrowser(); |
| 740 | 734 |
| 741 base::CommandLine cmdline(base::FilePath(L"openwith.exe")); | 735 base::CommandLine cmdline(base::FilePath(L"openwith.exe")); |
| 742 cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl()); | 736 cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl()); |
| 743 return base::LaunchProcess(cmdline, base::LaunchOptions()).IsValid(); | 737 return base::LaunchProcess(cmdline, base::LaunchOptions()).IsValid(); |
| 744 } | 738 } |
| OLD | NEW |