| 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_win.h" | 5 #include "chrome/browser/shell_integration_win.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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe, | 682 if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe, |
| 683 wprotocol)) { | 683 wprotocol)) { |
| 684 LOG(ERROR) << "Failed to launch the set-default-client Windows UI."; | 684 LOG(ERROR) << "Failed to launch the set-default-client Windows UI."; |
| 685 return false; | 685 return false; |
| 686 } | 686 } |
| 687 | 687 |
| 688 VLOG(1) << "Set-default-client Windows UI completed."; | 688 VLOG(1) << "Set-default-client Windows UI completed."; |
| 689 return true; | 689 return true; |
| 690 } | 690 } |
| 691 | 691 |
| 692 void SetAsDefaultProtocolClientUsingSystemSettings( |
| 693 const std::string& protocol, |
| 694 const base::Closure& on_finished_callback) { |
| 695 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 696 |
| 697 base::FilePath chrome_exe; |
| 698 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 699 NOTREACHED() << "Error getting app exe path"; |
| 700 on_finished_callback.Run(); |
| 701 return; |
| 702 } |
| 703 |
| 704 // The helper manages its own lifetime. |
| 705 base::string16 wprotocol(base::UTF8ToUTF16(protocol)); |
| 706 static const wchar_t* const kProtocols[] = {wprotocol.c_str(), nullptr}; |
| 707 OpenSystemSettingsHelper::Begin(kProtocols, on_finished_callback); |
| 708 |
| 709 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 710 ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe, |
| 711 wprotocol); |
| 712 } |
| 713 |
| 692 } // namespace win | 714 } // namespace win |
| 693 | 715 |
| 694 } // namespace shell_integration | 716 } // namespace shell_integration |
| OLD | NEW |