| 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; | 914 OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; |
| 915 HRESULT hr = SHOpenWithDialog(NULL, &open_as_info); | 915 HRESULT hr = SHOpenWithDialog(NULL, &open_as_info); |
| 916 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol | 916 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol |
| 917 << " handler; hr=0x" << std::hex << hr; | 917 << " handler; hr=0x" << std::hex << hr; |
| 918 if (FAILED(hr)) | 918 if (FAILED(hr)) |
| 919 return false; | 919 return false; |
| 920 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); | 920 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
| 921 return true; | 921 return true; |
| 922 } | 922 } |
| 923 | 923 |
| 924 // Launches the Windows 7 and Windows 8 application association dialog, which | |
| 925 // is the only documented way to make a browser the default browser on | |
| 926 // Windows 8. | |
| 927 bool LaunchApplicationAssociationDialog(const base::string16& app_id) { | |
| 928 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui; | |
| 929 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI); | |
| 930 if (FAILED(hr)) | |
| 931 return false; | |
| 932 hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str()); | |
| 933 return SUCCEEDED(hr); | |
| 934 } | |
| 935 | |
| 936 // Returns true if the current install's |chrome_exe| has been registered with | 924 // Returns true if the current install's |chrome_exe| has been registered with |
| 937 // |suffix|. | 925 // |suffix|. |
| 938 // |confirmation_level| is the level of verification desired as described in | 926 // |confirmation_level| is the level of verification desired as described in |
| 939 // the RegistrationConfirmationLevel enum above. | 927 // the RegistrationConfirmationLevel enum above. |
| 940 // |suffix| can be the empty string (this is used to support old installs | 928 // |suffix| can be the empty string (this is used to support old installs |
| 941 // where we used to not suffix user-level installs if they were the first to | 929 // where we used to not suffix user-level installs if they were the first to |
| 942 // request the non-suffixed registry entries on the machine). | 930 // request the non-suffixed registry entries on the machine). |
| 943 // NOTE: This a quick check that only validates that a single registry entry | 931 // NOTE: This a quick check that only validates that a single registry entry |
| 944 // points to |chrome_exe|. This should only be used at run-time to determine | 932 // points to |chrome_exe|. This should only be used at run-time to determine |
| 945 // how Chrome is registered, not to know whether the registration is complete | 933 // how Chrome is registered, not to know whether the registration is complete |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 base::string16 key_path(ShellUtil::kRegClasses); | 2502 base::string16 key_path(ShellUtil::kRegClasses); |
| 2515 key_path.push_back(base::FilePath::kSeparators[0]); | 2503 key_path.push_back(base::FilePath::kSeparators[0]); |
| 2516 key_path.append(prog_id); | 2504 key_path.append(prog_id); |
| 2517 return InstallUtil::DeleteRegistryKey( | 2505 return InstallUtil::DeleteRegistryKey( |
| 2518 HKEY_CURRENT_USER, key_path, WorkItem::kWow64Default); | 2506 HKEY_CURRENT_USER, key_path, WorkItem::kWow64Default); |
| 2519 | 2507 |
| 2520 // TODO(mgiuca): Remove the extension association entries. This requires that | 2508 // TODO(mgiuca): Remove the extension association entries. This requires that |
| 2521 // the extensions associated with a particular prog_id are stored in that | 2509 // the extensions associated with a particular prog_id are stored in that |
| 2522 // prog_id's key. | 2510 // prog_id's key. |
| 2523 } | 2511 } |
| OLD | NEW |