Chromium Code Reviews| 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 // Always returns the empty string on system-level installs. |
| 209 // if there are multiple users on the machine, each with their own copy of | 209 // |
| 210 // Chromium that they want to set as default browser. | 210 // 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 | 211 // the current install at run-time, not for install-time decisions. |
| 212 // existence of Default Browser registry key with this suffix and | 212 // There are no guarantees that this suffix will not change later: |
| 213 // returns true if it exists. In all other cases it returns false. | 213 // (e.g. if two user-level installs were previously installed in parallel on |
| 214 static bool GetUserSpecificDefaultBrowserSuffix(BrowserDistribution* dist, | 214 // the same machine, both without admin rights and with no user-level install |
| 215 string16* entry); | 215 // having claimed the non-suffixed HKLM registrations, they both have no |
| 216 // suffix in their progId entries (as per the old suffix rules). If they were | |
| 217 // to both fully register (i.e. click "Make Chrome Default" and go through | |
| 218 // UAC; or upgrade to Win8 and get the automatic no UAC full registration) | |
| 219 // they would then both get a suffixed registration as per the new suffix | |
| 220 // rules). | |
| 221 // | |
| 222 // |chrome_exe| The path to the currently installed (or running) chrome.exe. | |
| 223 static string16 GetCurrentInstallationSuffix(BrowserDistribution* dist, | |
| 224 const string16& chrome_exe); | |
| 225 | |
| 226 // An enum used to tell CurrentUserIsRegisteredWithSuffix() which level of | |
| 227 // registration we want to confirm. | |
| 228 enum RegistrationConfirmationLevel { | |
| 229 // Only look for Chrome's ProgIds. | |
| 230 // This is sufficient when we are trying to determine the suffix of the | |
| 231 // currently running Chrome as system registrations might not be present. | |
| 232 CONFIRM_PROGID_REGISTRATION = 0, | |
| 233 // Confirm that Chrome is registered on the system (i.e. registered with | |
| 234 // Defaut Programs). These registrations can be in HKCU as of Windows 8. | |
| 235 CONFIRM_SYSTEM_REGISTRATION, | |
| 236 // Same as CONFIRM_SYSTEM_REGISTRATION, but only look in HKLM (used when | |
| 237 // uninstalling to know whether elevation is required to clean up the | |
| 238 // registry). | |
| 239 CONFIRM_SYSTEM_REGISTRATION_IN_HKLM, | |
|
gab
2012/06/08 15:47:38
Added this enum entry to allow uninstall.cc to che
| |
| 240 }; | |
| 241 | |
| 242 // Returns true if the current install's |chrome_exe| has been registered with | |
| 243 // |suffix|. | |
| 244 // |confirmation_level| is the level of verification desired as described in | |
| 245 // the RegistrationConfirmationLevel enum above. | |
| 246 // |suffix| can be the empty string (this is used to support old installs | |
| 247 // where we used to not suffix user-level installs if they were the first to | |
| 248 // request the non-suffixed registry entries on the machine). | |
| 249 // NOTE: This a quick check that only validates that a single registry entry | |
| 250 // points to |chrome_exe|. This should only be used at run-time to determine | |
| 251 // how Chrome is registered, not to know whether the registration is complete | |
| 252 // at install-time (IsChromeRegistered() can be used for that). | |
| 253 static bool QuickIsChromeRegistered( | |
| 254 BrowserDistribution* dist, | |
| 255 const string16& chrome_exe, | |
| 256 const string16& suffix, | |
| 257 RegistrationConfirmationLevel confirmation_level); | |
| 216 | 258 |
| 217 // Make Chrome the default browser. This function works by going through | 259 // Make Chrome the default browser. This function works by going through |
| 218 // the url protocols and file associations that are related to general | 260 // the url protocols and file associations that are related to general |
| 219 // browsing, e.g. http, https, .html etc., and requesting to become the | 261 // 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 | 262 // 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 | 263 // false to indicate failure, which is consistent with the return value of |
| 222 // ShellIntegration::IsDefaultBrowser. | 264 // ShellIntegration::IsDefaultBrowser. |
| 223 // | 265 // |
| 224 // In the case of failure any successful changes will be left, however no | 266 // In the case of failure any successful changes will be left, however no |
| 225 // more changes will be attempted. | 267 // more changes will be attempted. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 const string16& icon_path, | 386 const string16& icon_path, |
| 345 int icon_index, | 387 int icon_index, |
| 346 uint32 options); | 388 uint32 options); |
| 347 | 389 |
| 348 private: | 390 private: |
| 349 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 391 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 350 }; | 392 }; |
| 351 | 393 |
| 352 | 394 |
| 353 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 395 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |