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 // This file defines functions that integrate Chrome in Windows shell. These | 5 // This file defines functions that integrate Chrome in Windows shell. These |
6 // functions can be used by Chrome as well as Chrome installer. All of the | 6 // functions can be used by Chrome as well as Chrome installer. All of the |
7 // work is done by the local functions defined in anonymous namespace in | 7 // work is done by the local functions defined in anonymous namespace in |
8 // this class. | 8 // this class. |
9 | 9 |
10 #include "chrome/installer/util/shell_util.h" | 10 #include "chrome/installer/util/shell_util.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 // It is required that Chrome be already *registered* for the given protocol. | 603 // It is required that Chrome be already *registered* for the given protocol. |
604 bool LaunchSelectDefaultProtocolHandlerDialog(const wchar_t* protocol) { | 604 bool LaunchSelectDefaultProtocolHandlerDialog(const wchar_t* protocol) { |
605 DCHECK(protocol); | 605 DCHECK(protocol); |
606 OPENASINFO open_as_info = {}; | 606 OPENASINFO open_as_info = {}; |
607 open_as_info.pcszFile = protocol; | 607 open_as_info.pcszFile = protocol; |
608 open_as_info.oaifInFlags = | 608 open_as_info.oaifInFlags = |
609 OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; | 609 OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; |
610 HRESULT hr = SHOpenWithDialog(NULL, &open_as_info); | 610 HRESULT hr = SHOpenWithDialog(NULL, &open_as_info); |
611 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol | 611 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol |
612 << " handler; hr=0x" << std::hex << hr; | 612 << " handler; hr=0x" << std::hex << hr; |
613 return SUCCEEDED(hr); | 613 if (FAILED(hr)) |
| 614 return false; |
| 615 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
| 616 return true; |
614 } | 617 } |
615 | 618 |
616 // Launches the Windows 7 and Windows 8 application association dialog, which | 619 // Launches the Windows 7 and Windows 8 application association dialog, which |
617 // is the only documented way to make a browser the default browser on | 620 // is the only documented way to make a browser the default browser on |
618 // Windows 8. | 621 // Windows 8. |
619 bool LaunchApplicationAssociationDialog(const string16& app_id) { | 622 bool LaunchApplicationAssociationDialog(const string16& app_id) { |
620 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui; | 623 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui; |
621 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI); | 624 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI); |
622 if (FAILED(hr)) | 625 if (FAILED(hr)) |
623 return false; | 626 return false; |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 chrome_exe.c_str(), | 1511 chrome_exe.c_str(), |
1509 shortcut.c_str(), | 1512 shortcut.c_str(), |
1510 chrome_path.value().c_str(), | 1513 chrome_path.value().c_str(), |
1511 arguments.c_str(), | 1514 arguments.c_str(), |
1512 description.c_str(), | 1515 description.c_str(), |
1513 icon_path.c_str(), | 1516 icon_path.c_str(), |
1514 icon_index, | 1517 icon_index, |
1515 app_id.c_str(), | 1518 app_id.c_str(), |
1516 ConvertShellUtilShortcutOptionsToFileUtil(options)); | 1519 ConvertShellUtilShortcutOptionsToFileUtil(options)); |
1517 } | 1520 } |
OLD | NEW |