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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // returns false. If system_level is true this function returns the path | 197 // 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 | 198 // 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). | 199 // User's profile only affects any new user profiles (not existing ones). |
200 static bool GetQuickLaunchPath(bool system_level, FilePath* path); | 200 static bool GetQuickLaunchPath(bool system_level, FilePath* path); |
201 | 201 |
202 // Gets a mapping of all registered browser (on local machine) names and | 202 // Gets a mapping of all registered browser (on local machine) names and |
203 // their reinstall command (which usually sets browser as default). | 203 // their reinstall command (which usually sets browser as default). |
204 static void GetRegisteredBrowsers(BrowserDistribution* dist, | 204 static void GetRegisteredBrowsers(BrowserDistribution* dist, |
205 std::map<string16, string16>* browsers); | 205 std::map<string16, string16>* browsers); |
206 | 206 |
207 // This function gets a suffix (user's login name) that can be added | 207 // 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 | 208 // Note: this method returns the empty string on system-level installs by |
209 // if there are multiple users on the machine, each with their own copy of | 209 // design as no system-level installs is ever suffixed. |
210 // Chromium that they want to set as default browser. | 210 // |
211 // This suffix value is assigned to |entry|. The function also checks for | 211 // This method is meant for external methods which need to know the suffix of |
212 // existence of Default Browser registry key with this suffix and | 212 // the current install at run-time, not for install-time decisions. |
213 // returns true if it exists. In all other cases it returns false. | 213 // There are no guarantees that this suffix will not change later: |
214 static bool GetUserSpecificDefaultBrowserSuffix(BrowserDistribution* dist, | 214 // (e.g. if two user-level installs were previously installed in parallel on |
215 string16* entry); | 215 // the same machine, both without admin rights and with no user-level install |
| 216 // having claimed the non-suffixed HKLM registrations, they both have no |
| 217 // suffix in their progId entries (as per the old suffix rules). If they were |
| 218 // to both fully register (i.e. click "Make Chrome Default" and go through |
| 219 // UAC; or upgrade to Win8 and get the automatic no UAC full registration) |
| 220 // they would then both get a suffixed registration as per the new suffix |
| 221 // rules). |
| 222 static string16 GetCurrentInstallationSuffix(); |
| 223 |
| 224 // Returns true if the current user-level install has been fully registered |
| 225 // without a suffix. This is used to support old installs where we used to |
| 226 // not suffix user-level installs if they were the first to request the |
| 227 // non-suffixed registry entries on the machine. This however created clashes |
| 228 // with system-level installs when updating user-level installs to |
| 229 // system-level installs. There is no downside to suffixing anyways (the name |
| 230 // registered is not user visible). |
| 231 // All the conditions below have to be true for it to return true: |
| 232 // - Software\Clients\StartMenuInternet\Chromium\"" key should have a valid |
| 233 // value. |
| 234 // - The value should be same as given value in |chrome_exe|. |
| 235 static bool CurrentUserIsRegisteredWithNoSuffix(BrowserDistribution* dist, |
| 236 const string16& chrome_exe); |
| 237 |
| 238 // Returns true if any of the possible Chrome registry keys are present in |
| 239 // HKLM with |suffix|. |
| 240 static bool IsInstallationPresentInHKLM(BrowserDistribution* dist, |
| 241 const string16& chrome_exe, |
| 242 const string16& suffix); |
216 | 243 |
217 // Make Chrome the default browser. This function works by going through | 244 // Make Chrome the default browser. This function works by going through |
218 // the url protocols and file associations that are related to general | 245 // the url protocols and file associations that are related to general |
219 // browsing, e.g. http, https, .html etc., and requesting to become the | 246 // 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 | 247 // 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 | 248 // false to indicate failure, which is consistent with the return value of |
222 // ShellIntegration::IsDefaultBrowser. | 249 // ShellIntegration::IsDefaultBrowser. |
223 // | 250 // |
224 // In the case of failure any successful changes will be left, however no | 251 // In the case of failure any successful changes will be left, however no |
225 // more changes will be attempted. | 252 // more changes will be attempted. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 const string16& icon_path, | 371 const string16& icon_path, |
345 int icon_index, | 372 int icon_index, |
346 uint32 options); | 373 uint32 options); |
347 | 374 |
348 private: | 375 private: |
349 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 376 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
350 }; | 377 }; |
351 | 378 |
352 | 379 |
353 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 380 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |