OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_INSTALLER_UTIL_SHELL_REGISTRY_UTIL_H_ |
| 6 #define CHROME_INSTALLER_UTIL_SHELL_REGISTRY_UTIL_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/strings/string16.h" |
| 11 |
| 12 class BrowserDistribution; |
| 13 class RegistryEntry; |
| 14 |
| 15 namespace installer_util { |
| 16 |
| 17 extern const wchar_t kReinstallCommand[]; |
| 18 |
| 19 // Details about a Windows application, to be entered into the registry for the |
| 20 // purpose of file associations. |
| 21 struct ApplicationInfo { |
| 22 ApplicationInfo() : file_type_icon_index(0), application_icon_index(0) {} |
| 23 |
| 24 // The ProgId used by Windows for file associations with this application. |
| 25 // Must not be empty or start with a '.'. |
| 26 base::string16 prog_id; |
| 27 // The friendly name, and the path of the icon that will be used for files of |
| 28 // these types when associated with this application by default. (They are NOT |
| 29 // the name/icon that will represent the application under the Open With |
| 30 // menu.) |
| 31 base::string16 file_type_name; |
| 32 base::FilePath file_type_icon_path; |
| 33 int file_type_icon_index; |
| 34 // The command to execute when opening a file via this association. It should |
| 35 // contain "%1" (to tell Windows to pass the filename as an argument). |
| 36 // TODO(mgiuca): |command_line| should be a base::CommandLine. |
| 37 base::string16 command_line; |
| 38 // The AppUserModelId used by Windows 8 for this application. Distinct from |
| 39 // |prog_id|. |
| 40 base::string16 app_id; |
| 41 |
| 42 // User-visible details about this application. Any of these may be empty. |
| 43 base::string16 application_name; |
| 44 base::FilePath application_icon_path; |
| 45 int application_icon_index; |
| 46 base::string16 application_description; |
| 47 base::string16 publisher_name; |
| 48 |
| 49 // The CLSID for the application's DelegateExecute handler. May be empty. |
| 50 base::string16 delegate_clsid; |
| 51 }; |
| 52 |
| 53 // Returns the Windows browser client registration key for Chrome. For example: |
| 54 // "Software\Clients\StartMenuInternet\Chromium[.user]". Strictly speaking, we |
| 55 // should use the name of the executable (e.g., "chrome.exe"), but that ship has |
| 56 // sailed. The cost of switching now is re-prompting users to make Chrome their |
| 57 // default browser, which isn't polite. |suffix| is the user-specific |
| 58 // registration suffix; see GetUserSpecificDefaultBrowserSuffix in shell_util.h |
| 59 // for details. |
| 60 base::string16 GetBrowserClientKey(BrowserDistribution* dist, |
| 61 const base::string16& suffix); |
| 62 |
| 63 // Gets the registry entries to register an application in the Windows registry. |
| 64 // |app_info| provides all of the information needed. |
| 65 void GetProgIdEntries(const ApplicationInfo& app_info, |
| 66 ScopedVector<RegistryEntry>* entries); |
| 67 |
| 68 // This method returns a list of all the registry entries that are needed to |
| 69 // register this installation's ProgId and AppId. These entries need to be |
| 70 // registered in HKLM prior to Win8. |
| 71 void GetChromeProgIdEntries(BrowserDistribution* dist, |
| 72 const base::FilePath& chrome_exe, |
| 73 const base::string16& suffix, |
| 74 ScopedVector<RegistryEntry>* entries); |
| 75 |
| 76 // This method returns a list of the registry entries needed to declare a |
| 77 // capability of handling a protocol on Windows. |
| 78 void GetProtocolCapabilityEntries(BrowserDistribution* dist, |
| 79 const base::string16& suffix, |
| 80 const base::string16& protocol, |
| 81 ScopedVector<RegistryEntry>* entries); |
| 82 |
| 83 // This method returns a list of the registry entries required to register this |
| 84 // installation in "RegisteredApplications" on Windows (to appear in Default |
| 85 // Programs, StartMenuInternet, etc.). These entries need to be registered in |
| 86 // HKLM prior to Win8. If |suffix| is not empty, these entries are guaranteed to |
| 87 // be unique on this machine. |
| 88 void GetShellIntegrationEntries(BrowserDistribution* dist, |
| 89 const base::FilePath& chrome_exe, |
| 90 const base::string16& suffix, |
| 91 ScopedVector<RegistryEntry>* entries); |
| 92 |
| 93 // Gets the registry entries to register an application as a handler for a |
| 94 // particular file extension. |prog_id| is the ProgId used by Windows for the |
| 95 // application. |ext| is the file extension, which must begin with a '.'. |
| 96 void GetAppExtRegistrationEntries(const base::string16& prog_id, |
| 97 const base::string16& ext, |
| 98 ScopedVector<RegistryEntry>* entries); |
| 99 |
| 100 // This method returns a list of the registry entries required for this |
| 101 // installation to be registered in the Windows shell. |
| 102 // In particular: |
| 103 // - App Paths |
| 104 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 |
| 105 // - File Associations |
| 106 // http://msdn.microsoft.com/en-us/library/bb166549 |
| 107 // These entries need to be registered in HKLM prior to Win8. |
| 108 void GetChromeAppRegistrationEntries(const base::FilePath& chrome_exe, |
| 109 const base::string16& suffix, |
| 110 ScopedVector<RegistryEntry>* entries); |
| 111 |
| 112 // Gets the registry entries to register an application as the default handler |
| 113 // for a particular file extension. |prog_id| is the ProgId used by Windows for |
| 114 // the application. |ext| is the file extension, which must begin with a '.'. If |
| 115 // |overwrite_existing|, always sets the default handler; otherwise only sets if |
| 116 // there is no existing default. |
| 117 // |
| 118 // This has no effect on Windows 8. Windows 8 ignores the default and lets the |
| 119 // user choose. If there is only one handler for a file, it will automatically |
| 120 // become the default. Otherwise, the first time the user opens a file, they are |
| 121 // presented with the dialog to set the default handler. (This is roughly |
| 122 // equivalent to being called with |overwrite_existing| false.) |
| 123 void GetAppDefaultRegistrationEntries(const base::string16& prog_id, |
| 124 const base::string16& ext, |
| 125 bool overwrite_existing, |
| 126 ScopedVector<RegistryEntry>* entries); |
| 127 |
| 128 // This method returns a list of all the user level registry entries that are |
| 129 // needed to make Chromium the default handler for a protocol on XP. |
| 130 void GetXPStyleUserProtocolEntries(const base::string16& protocol, |
| 131 const base::string16& chrome_icon, |
| 132 const base::string16& chrome_open, |
| 133 ScopedVector<RegistryEntry>* entries); |
| 134 |
| 135 // This method returns a list of all the user level registry entries that are |
| 136 // needed to make Chromium default browser on XP. Some of these entries are |
| 137 // irrelevant in recent versions of Windows, but we register them anyways as |
| 138 // some legacy apps are hardcoded to lookup those values. |
| 139 void GetXPStyleDefaultBrowserUserEntries(BrowserDistribution* dist, |
| 140 const base::FilePath& chrome_exe, |
| 141 const base::string16& suffix, |
| 142 ScopedVector<RegistryEntry>* entries); |
| 143 |
| 144 } // namespace installer_util |
| 145 |
| 146 #endif // CHROME_INSTALLER_UTIL_SHELL_REGISTRY_UTIL_H_ |
OLD | NEW |