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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // returns false. If system_level is true this function returns the path | 204 // returns false. If system_level is true this function returns the path |
198 // to Default Users Quick Launch shortcuts path. Adding a shortcut to Default | 205 // to Default Users Quick Launch shortcuts path. Adding a shortcut to Default |
199 // User's profile only affects any new user profiles (not existing ones). | 206 // User's profile only affects any new user profiles (not existing ones). |
200 static bool GetQuickLaunchPath(bool system_level, FilePath* path); | 207 static bool GetQuickLaunchPath(bool system_level, FilePath* path); |
201 | 208 |
202 // Gets a mapping of all registered browser (on local machine) names and | 209 // Gets a mapping of all registered browser (on local machine) names and |
203 // their reinstall command (which usually sets browser as default). | 210 // their reinstall command (which usually sets browser as default). |
204 static void GetRegisteredBrowsers(BrowserDistribution* dist, | 211 static void GetRegisteredBrowsers(BrowserDistribution* dist, |
205 std::map<string16, string16>* browsers); | 212 std::map<string16, string16>* browsers); |
206 | 213 |
207 // This function gets a suffix (user's login name) that can be added | 214 // Returns the suffix this user's Chrome install is registered with. |
208 // to Chromium default browser entry in the registry to create a unique name | 215 // Always returns the empty string on system-level installs. |
209 // if there are multiple users on the machine, each with their own copy of | 216 // |
210 // Chromium that they want to set as default browser. | 217 // This method is meant for external methods which need to know the suffix of |
211 // This suffix value is assigned to |entry|. The function also checks for | 218 // the current install at run-time, not for install-time decisions. |
212 // existence of Default Browser registry key with this suffix and | 219 // There are no guarantees that this suffix will not change later: |
213 // returns true if it exists. In all other cases it returns false. | 220 // (e.g. if two user-level installs were previously installed in parallel on |
214 static bool GetUserSpecificDefaultBrowserSuffix(BrowserDistribution* dist, | 221 // the same machine, both without admin rights and with no user-level install |
215 string16* entry); | 222 // having claimed the non-suffixed HKLM registrations, they both have no |
| 223 // suffix in their progId entries (as per the old suffix rules). If they were |
| 224 // to both fully register (i.e. click "Make Chrome Default" and go through |
| 225 // UAC; or upgrade to Win8 and get the automatic no UAC full registration) |
| 226 // they would then both get a suffixed registration as per the new suffix |
| 227 // rules). |
| 228 // |
| 229 // |chrome_exe| The path to the currently installed (or running) chrome.exe. |
| 230 static string16 GetCurrentInstallationSuffix(BrowserDistribution* dist, |
| 231 const string16& chrome_exe); |
216 | 232 |
217 // Make Chrome the default browser. This function works by going through | 233 // Make Chrome the default browser. This function works by going through |
218 // the url protocols and file associations that are related to general | 234 // the url protocols and file associations that are related to general |
219 // browsing, e.g. http, https, .html etc., and requesting to become the | 235 // browsing, e.g. http, https, .html etc., and requesting to become the |
220 // default handler for each. If any of these fails the operation will return | 236 // default handler for each. If any of these fails the operation will return |
221 // false to indicate failure, which is consistent with the return value of | 237 // false to indicate failure, which is consistent with the return value of |
222 // ShellIntegration::IsDefaultBrowser. | 238 // ShellIntegration::IsDefaultBrowser. |
223 // | 239 // |
224 // In the case of failure any successful changes will be left, however no | 240 // In the case of failure any successful changes will be left, however no |
225 // more changes will be attempted. | 241 // more changes will be attempted. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 const string16& icon_path, | 369 const string16& icon_path, |
354 int icon_index, | 370 int icon_index, |
355 uint32 options); | 371 uint32 options); |
356 | 372 |
357 private: | 373 private: |
358 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 374 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
359 }; | 375 }; |
360 | 376 |
361 | 377 |
362 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 378 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |