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 declares methods that are useful for integrating Chrome in | 5 // This file declares methods that are useful for integrating Chrome in |
6 // Windows shell. These methods are all static and currently part of | 6 // Windows shell. These methods are all static and currently part of |
7 // ShellUtil class. | 7 // ShellUtil class. |
8 | 8 |
9 #ifndef CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 9 #ifndef CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
10 #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 10 #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 // Registry value name of the run verb. | 116 // Registry value name of the run verb. |
117 static const wchar_t* kRegVerbRun; | 117 static const wchar_t* kRegVerbRun; |
118 | 118 |
119 // Registry value name for command entries. | 119 // Registry value name for command entries. |
120 static const wchar_t* kRegCommand; | 120 static const wchar_t* kRegCommand; |
121 | 121 |
122 // Registry value name for the DelegateExecute verb handler. | 122 // Registry value name for the DelegateExecute verb handler. |
123 static const wchar_t* kRegDelegateExecute; | 123 static const wchar_t* kRegDelegateExecute; |
124 | 124 |
| 125 // Returns true if |chrome_exe| is registered in HKLM with |suffix|. |
| 126 // Note: This only checks one deterministic key in HKLM for |chrome_exe| and |
| 127 // doesn't otherwise validate a full Chrome install in HKLM. |
| 128 static bool QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist, |
| 129 const string16& chrome_exe, |
| 130 const string16& suffix); |
| 131 |
125 // Creates Chrome shortcut on the Desktop. | 132 // Creates Chrome shortcut on the Desktop. |
126 // |dist| gives the type of browser distribution currently in use. | 133 // |dist| gives the type of browser distribution currently in use. |
127 // |chrome_exe| provides the target path information. | 134 // |chrome_exe| provides the target path information. |
128 // |description| provides the shortcut's "comment" property. | 135 // |description| provides the shortcut's "comment" property. |
129 // |appended_name| provides a string to be appended to the distribution name, | 136 // |appended_name| provides a string to be appended to the distribution name, |
130 // and can be the empty string. | 137 // and can be the empty string. |
131 // |arguments| gives a set of arguments to be passed to the executable. | 138 // |arguments| gives a set of arguments to be passed to the executable. |
132 // |icon_path| provides the path to the icon file to use. | 139 // |icon_path| provides the path to the icon file to use. |
133 // |icon_index| provides the index of the icon within the provided icon file. | 140 // |icon_index| provides the index of the icon within the provided icon file. |
134 // If |shell_change| is CURRENT_USER, the shortcut is created in the | 141 // If |shell_change| is CURRENT_USER, the shortcut is created in the |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 208 |
202 // Gets a mapping of all registered browser names (excluding browsers in the | 209 // Gets a mapping of all registered browser names (excluding browsers in the |
203 // |dist| distribution) and their reinstall command (which usually sets | 210 // |dist| distribution) and their reinstall command (which usually sets |
204 // browser as default). | 211 // browser as default). |
205 // Given browsers can be registered in HKCU (as of Win7) and/or in HKLM, this | 212 // Given browsers can be registered in HKCU (as of Win7) and/or in HKLM, this |
206 // method looks in both and gives precedence to values in HKCU as per the msdn | 213 // method looks in both and gives precedence to values in HKCU as per the msdn |
207 // standard: http://goo.gl/xjczJ. | 214 // standard: http://goo.gl/xjczJ. |
208 static void GetRegisteredBrowsers(BrowserDistribution* dist, | 215 static void GetRegisteredBrowsers(BrowserDistribution* dist, |
209 std::map<string16, string16>* browsers); | 216 std::map<string16, string16>* browsers); |
210 | 217 |
211 // This function gets a suffix (user's login name) that can be added | 218 // Returns the suffix this user's Chrome install is registered with. |
212 // to Chromium default browser entry in the registry to create a unique name | 219 // Always returns the empty string on system-level installs. |
213 // if there are multiple users on the machine, each with their own copy of | 220 // |
214 // Chromium that they want to set as default browser. | 221 // This method is meant for external methods which need to know the suffix of |
215 // This suffix value is assigned to |entry|. The function also checks for | 222 // the current install at run-time, not for install-time decisions. |
216 // existence of Default Browser registry key with this suffix and | 223 // There are no guarantees that this suffix will not change later: |
217 // returns true if it exists. In all other cases it returns false. | 224 // (e.g. if two user-level installs were previously installed in parallel on |
218 static bool GetUserSpecificDefaultBrowserSuffix(BrowserDistribution* dist, | 225 // the same machine, both without admin rights and with no user-level install |
219 string16* entry); | 226 // having claimed the non-suffixed HKLM registrations, they both have no |
| 227 // suffix in their progId entries (as per the old suffix rules). If they were |
| 228 // to both fully register (i.e. click "Make Chrome Default" and go through |
| 229 // UAC; or upgrade to Win8 and get the automatic no UAC full registration) |
| 230 // they would then both get a suffixed registration as per the new suffix |
| 231 // rules). |
| 232 // |
| 233 // |chrome_exe| The path to the currently installed (or running) chrome.exe. |
| 234 static string16 GetCurrentInstallationSuffix(BrowserDistribution* dist, |
| 235 const string16& chrome_exe); |
220 | 236 |
221 // Make Chrome the default browser. This function works by going through | 237 // Make Chrome the default browser. This function works by going through |
222 // the url protocols and file associations that are related to general | 238 // the url protocols and file associations that are related to general |
223 // browsing, e.g. http, https, .html etc., and requesting to become the | 239 // browsing, e.g. http, https, .html etc., and requesting to become the |
224 // default handler for each. If any of these fails the operation will return | 240 // default handler for each. If any of these fails the operation will return |
225 // false to indicate failure, which is consistent with the return value of | 241 // false to indicate failure, which is consistent with the return value of |
226 // ShellIntegration::IsDefaultBrowser. | 242 // ShellIntegration::IsDefaultBrowser. |
227 // | 243 // |
228 // In the case of failure any successful changes will be left, however no | 244 // In the case of failure any successful changes will be left, however no |
229 // more changes will be attempted. | 245 // more changes will be attempted. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 const string16& icon_path, | 376 const string16& icon_path, |
361 int icon_index, | 377 int icon_index, |
362 uint32 options); | 378 uint32 options); |
363 | 379 |
364 private: | 380 private: |
365 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 381 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
366 }; | 382 }; |
367 | 383 |
368 | 384 |
369 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 385 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |