| 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_ |
| 11 | 11 |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/file_path.h" |
| 19 #include "base/logging.h" |
| 18 #include "base/string16.h" | 20 #include "base/string16.h" |
| 19 #include "chrome/installer/util/work_item_list.h" | 21 #include "chrome/installer/util/work_item_list.h" |
| 20 | 22 |
| 21 class BrowserDistribution; | 23 class BrowserDistribution; |
| 22 class FilePath; | |
| 23 | |
| 24 namespace base { | |
| 25 class DictionaryValue; | |
| 26 } | |
| 27 | 24 |
| 28 // This is a utility class that provides common shell integration methods | 25 // This is a utility class that provides common shell integration methods |
| 29 // that can be used by installer as well as Chrome. | 26 // that can be used by installer as well as Chrome. |
| 30 class ShellUtil { | 27 class ShellUtil { |
| 31 public: | 28 public: |
| 32 // Input to any methods that make changes to OS shell. | 29 // Input to any methods that make changes to OS shell. |
| 33 enum ShellChange { | 30 enum ShellChange { |
| 34 CURRENT_USER = 0x1, // Make any shell changes only at the user level | 31 CURRENT_USER = 0x1, // Make any shell changes only at the user level |
| 35 SYSTEM_LEVEL = 0x2 // Make any shell changes only at the system level | 32 SYSTEM_LEVEL = 0x2 // Make any shell changes only at the system level |
| 36 }; | 33 }; |
| 37 | 34 |
| 38 enum VerifyShortcutStatus { | 35 // Typical shortcut directories. Resolved in GetShortcutPath(). |
| 39 VERIFY_SHORTCUT_SUCCESS = 0, | 36 enum ChromeShortcutLocation { |
| 40 VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 37 SHORTCUT_DESKTOP, |
| 41 VERIFY_SHORTCUT_FAILURE_PATH, | 38 SHORTCUT_QUICK_LAUNCH, |
| 42 VERIFY_SHORTCUT_FAILURE_DESCRIPTION, | 39 SHORTCUT_START_MENU, |
| 43 VERIFY_SHORTCUT_FAILURE_ICON_INDEX, | 40 }; |
| 41 |
| 42 enum ChromeShortcutOperation { |
| 43 // Create a new shortcut (overwriting if necessary). |
| 44 SHORTCUT_CREATE_ALWAYS, |
| 45 // Create the per-user shortcut only if its system-level equivalent is not |
| 46 // present. |
| 47 SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL, |
| 48 // Overwrite an existing shortcut (fail if the shortcut doesn't exist). |
| 49 SHORTCUT_REPLACE_EXISTING, |
| 50 // Update specified properties only on an existing shortcut. |
| 51 SHORTCUT_UPDATE_EXISTING, |
| 52 }; |
| 53 |
| 54 // Properties for shortcuts to chrome.exe. Properties set will be applied to |
| 55 // the shortcut on creation/update. On update, unset properties are ignored; |
| 56 // on create (and replaced) unset properties might have a default value (see |
| 57 // individual property setters below for details). |
| 58 // Callers are encouraged to use the setters provided which take care of |
| 59 // setting |options| as desired. |
| 60 struct ChromeShortcutProperties { |
| 61 enum ChromeIndividualProperties { |
| 62 PROPERTIES_CHROME_EXE = 1 << 0, |
| 63 PROPERTIES_ARGUMENTS = 1 << 1, |
| 64 PROPERTIES_DESCRIPTION = 1 << 2, |
| 65 PROPERTIES_ICON = 1 << 3, |
| 66 PROPERTIES_APP_ID = 1 << 4, |
| 67 PROPERTIES_SHORTCUT_NAME = 1 << 5, |
| 68 PROPERTIES_DUAL_MODE = 1 << 6, |
| 69 }; |
| 70 |
| 71 explicit ChromeShortcutProperties(ShellChange level_in) |
| 72 : level(level_in), dual_mode(false), pin_to_taskbar(false), |
| 73 options(0U) {} |
| 74 |
| 75 // Sets the chrome.exe to launch from this shortcut. This is mandatory when |
| 76 // creating a shortcut. |
| 77 void set_chrome_exe(const FilePath& chrome_exe_in) { |
| 78 chrome_exe = chrome_exe_in; |
| 79 options |= PROPERTIES_CHROME_EXE; |
| 80 } |
| 81 |
| 82 // Sets the arguments to be passed to |chrome_exe| when launching from this |
| 83 // shortcut. |
| 84 // The length of this string must be less than MAX_PATH. |
| 85 void set_arguments(const string16& arguments_in) { |
| 86 // Size restriction as per MSDN at |
| 87 // http://msdn.microsoft.com/library/windows/desktop/bb774954.aspx. |
| 88 DCHECK(arguments_in.length() < MAX_PATH); |
| 89 arguments = arguments_in; |
| 90 options |= PROPERTIES_ARGUMENTS; |
| 91 } |
| 92 |
| 93 // Sets the localized description of the shortcut. |
| 94 // Default: the current distribution's description. |
| 95 // The length of this string must be less than MAX_PATH. |
| 96 void set_description(const string16& description_in) { |
| 97 // Size restriction as per MSDN at |
| 98 // http://msdn.microsoft.com/library/windows/desktop/bb774955.aspx. |
| 99 DCHECK(description_in.length() < MAX_PATH); |
| 100 description = description_in; |
| 101 options |= PROPERTIES_DESCRIPTION; |
| 102 } |
| 103 |
| 104 // Sets the path to the icon (icon_index set to 0). |
| 105 // Default: chrome.exe (icon_index defaults to the current distribution's |
| 106 // icon index unless otherwise specified in master_preferences). |
| 107 void set_icon(const FilePath& icon_in) { |
| 108 icon = icon_in; |
| 109 options |= PROPERTIES_ICON; |
| 110 } |
| 111 |
| 112 // Sets the app model id for the shortcut (Win7+). |
| 113 // Default: the browser model id for the current install. |
| 114 void set_app_id(const string16& app_id_in) { |
| 115 app_id = app_id_in; |
| 116 options |= PROPERTIES_APP_ID; |
| 117 } |
| 118 |
| 119 // Forces the shortcut's name to |shortcut_name_in|. |
| 120 // Default: the current distribution's GetAppShortcutName(). |
| 121 // The ".lnk" extension will automatically be added to this name. |
| 122 void set_shortcut_name(const string16& shortcut_name_in) { |
| 123 shortcut_name = shortcut_name_in; |
| 124 options |= PROPERTIES_SHORTCUT_NAME; |
| 125 } |
| 126 |
| 127 // Sets whether this is a dual mode shortcut (Win8+). |
| 128 // NOTE: Only the default (no arguments and default browser appid) browser |
| 129 // shortcut in the Start menu (Start screen on Win8+) should be made dual |
| 130 // mode. |
| 131 void set_dual_mode(bool dual_mode_in) { |
| 132 dual_mode = dual_mode_in; |
| 133 options |= PROPERTIES_DUAL_MODE; |
| 134 } |
| 135 |
| 136 // Sets whether to pin this shortcut to the taskbar after creating it |
| 137 // (ignored if the shortcut is only being updated). |
| 138 // Note: This property doesn't have a mask in |options|. |
| 139 void set_pin_to_taskbar(bool pin_to_taskbar_in) { |
| 140 pin_to_taskbar = pin_to_taskbar_in; |
| 141 } |
| 142 |
| 143 bool has_chrome_exe() const { |
| 144 return (options & PROPERTIES_CHROME_EXE) != 0; |
| 145 } |
| 146 |
| 147 bool has_arguments() const { |
| 148 return (options & PROPERTIES_ARGUMENTS) != 0; |
| 149 } |
| 150 |
| 151 bool has_description() const { |
| 152 return (options & PROPERTIES_DESCRIPTION) != 0; |
| 153 } |
| 154 |
| 155 bool has_icon() const { |
| 156 return (options & PROPERTIES_ICON) != 0; |
| 157 } |
| 158 |
| 159 bool has_app_id() const { |
| 160 return (options & PROPERTIES_APP_ID) != 0; |
| 161 } |
| 162 |
| 163 bool has_shortcut_name() const { |
| 164 return (options & PROPERTIES_SHORTCUT_NAME) != 0; |
| 165 } |
| 166 |
| 167 bool has_dual_mode() const { |
| 168 return (options & PROPERTIES_CHROME_EXE) != 0; |
| 169 } |
| 170 |
| 171 // The level to install this shortcut at (CURRENT_USER for a per-user |
| 172 // shortcut and SYSTEM_LEVEL for an all-users shortcut). |
| 173 ShellChange level; |
| 174 |
| 175 FilePath chrome_exe; |
| 176 string16 arguments; |
| 177 string16 description; |
| 178 FilePath icon; |
| 179 string16 app_id; |
| 180 string16 shortcut_name; |
| 181 bool dual_mode; |
| 182 bool pin_to_taskbar; |
| 183 // Bitfield made of IndividualProperties. Properties set in |options| will |
| 184 // be used to create/update the shortcut, others will be ignored on update |
| 185 // and possibly replaced by default values on create (see individual |
| 186 // property setters above for details on default values). |
| 187 uint32 options; |
| 44 }; | 188 }; |
| 45 | 189 |
| 46 // Relative path of the URL Protocol registry entry (prefixed with '\'). | 190 // Relative path of the URL Protocol registry entry (prefixed with '\'). |
| 47 static const wchar_t* kRegURLProtocol; | 191 static const wchar_t* kRegURLProtocol; |
| 48 | 192 |
| 49 // Relative path of DefaultIcon registry entry (prefixed with '\'). | 193 // Relative path of DefaultIcon registry entry (prefixed with '\'). |
| 50 static const wchar_t* kRegDefaultIcon; | 194 static const wchar_t* kRegDefaultIcon; |
| 51 | 195 |
| 52 // Relative path of "shell" registry key. | 196 // Relative path of "shell" registry key. |
| 53 static const wchar_t* kRegShellPath; | 197 static const wchar_t* kRegShellPath; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Registry value name for the OpenWithProgids entry for file associations. | 279 // Registry value name for the OpenWithProgids entry for file associations. |
| 136 static const wchar_t* kRegOpenWithProgids; | 280 static const wchar_t* kRegOpenWithProgids; |
| 137 | 281 |
| 138 // Returns true if |chrome_exe| is registered in HKLM with |suffix|. | 282 // Returns true if |chrome_exe| is registered in HKLM with |suffix|. |
| 139 // Note: This only checks one deterministic key in HKLM for |chrome_exe| and | 283 // Note: This only checks one deterministic key in HKLM for |chrome_exe| and |
| 140 // doesn't otherwise validate a full Chrome install in HKLM. | 284 // doesn't otherwise validate a full Chrome install in HKLM. |
| 141 static bool QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist, | 285 static bool QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist, |
| 142 const string16& chrome_exe, | 286 const string16& chrome_exe, |
| 143 const string16& suffix); | 287 const string16& suffix); |
| 144 | 288 |
| 145 // Creates Chrome shortcut on the Desktop. | 289 // Sets |path| to the path for a shortcut at the |location| desired for the |
| 290 // given |level| (CURRENT_USER for per-user path and SYSTEM_LEVEL for |
| 291 // all-users path). |
| 292 // Returns false on failure. |
| 293 static bool GetShortcutPath(ChromeShortcutLocation location, |
| 294 BrowserDistribution* dist, |
| 295 ShellChange level, |
| 296 FilePath* path); |
| 297 |
| 298 // Updates Chrome shortcut in |location| (or creates it if |options| specify |
| 299 // SHORTCUT_CREATE_ALWAYS). |
| 146 // |dist| gives the type of browser distribution currently in use. | 300 // |dist| gives the type of browser distribution currently in use. |
| 147 // |chrome_exe| provides the target path information. | 301 // |properties| and |operation| affect this method as described on their |
| 148 // |description| provides the shortcut's "comment" property. | 302 // invidividual definitions above. |
| 149 // |appended_name| provides a string to be appended to the distribution name, | 303 static bool CreateOrUpdateChromeShortcut( |
| 150 // and can be the empty string. | 304 ChromeShortcutLocation location, |
| 151 // |arguments| gives a set of arguments to be passed to the executable. | 305 BrowserDistribution* dist, |
| 152 // |icon_path| provides the path to the icon file to use. | 306 const ChromeShortcutProperties& properties, |
| 153 // |icon_index| provides the index of the icon within the provided icon file. | 307 ChromeShortcutOperation operation); |
| 154 // If |shell_change| is CURRENT_USER, the shortcut is created in the | |
| 155 // Desktop folder of current user's profile. | |
| 156 // If |shell_change| is SYSTEM_LEVEL, the shortcut is created in the | |
| 157 // Desktop folder of the "All Users" profile. | |
| 158 // |options|: bitfield for which the options come from ChromeShortcutOptions. | |
| 159 // Returns true iff the method causes a shortcut to be created / updated. | |
| 160 static bool CreateChromeDesktopShortcut(BrowserDistribution* dist, | |
| 161 const string16& chrome_exe, | |
| 162 const string16& description, | |
| 163 const string16& appended_name, | |
| 164 const string16& arguments, | |
| 165 const string16& icon_path, | |
| 166 int icon_index, | |
| 167 ShellChange shell_change, | |
| 168 uint32 options); | |
| 169 | |
| 170 // Create Chrome shortcut on Quick Launch Bar. | |
| 171 // If shell_change is CURRENT_USER, the shortcut is created in the | |
| 172 // Quick Launch folder of current user's profile. | |
| 173 // If shell_change is SYSTEM_LEVEL, the shortcut is created in the | |
| 174 // Quick Launch folder of "Default User" profile. This will make sure | |
| 175 // that this shortcut will be seen by all the new users logging into the | |
| 176 // system. | |
| 177 // |options|: bitfield for which the options come from ChromeShortcutOptions. | |
| 178 static bool CreateChromeQuickLaunchShortcut(BrowserDistribution* dist, | |
| 179 const string16& chrome_exe, | |
| 180 int shell_change, | |
| 181 uint32 options); | |
| 182 | 308 |
| 183 // This method appends the Chrome icon index inside chrome.exe to the | 309 // This method appends the Chrome icon index inside chrome.exe to the |
| 184 // chrome.exe path passed in as input, to generate the full path for | 310 // chrome.exe path passed in as input, to generate the full path for |
| 185 // Chrome icon that can be used as value for Windows registry keys. | 311 // Chrome icon that can be used as value for Windows registry keys. |
| 186 // |chrome_exe| full path to chrome.exe. | 312 // |chrome_exe| full path to chrome.exe. |
| 187 static string16 GetChromeIcon(BrowserDistribution* dist, | 313 static string16 GetChromeIcon(BrowserDistribution* dist, |
| 188 const string16& chrome_exe); | 314 const string16& chrome_exe); |
| 189 | 315 |
| 190 // This method returns the command to open URLs/files using chrome. Typically | 316 // This method returns the command to open URLs/files using chrome. Typically |
| 191 // this command is written to the registry under shell\open\command key. | 317 // this command is written to the registry under shell\open\command key. |
| 192 // |chrome_exe|: the full path to chrome.exe | 318 // |chrome_exe|: the full path to chrome.exe |
| 193 static string16 GetChromeShellOpenCmd(const string16& chrome_exe); | 319 static string16 GetChromeShellOpenCmd(const string16& chrome_exe); |
| 194 | 320 |
| 195 // This method returns the command to be called by the DelegateExecute verb | 321 // This method returns the command to be called by the DelegateExecute verb |
| 196 // handler to launch chrome on Windows 8. Typically this command is written to | 322 // handler to launch chrome on Windows 8. Typically this command is written to |
| 197 // the registry under the HKCR\Chrome\.exe\shell\(open|run)\command key. | 323 // the registry under the HKCR\Chrome\.exe\shell\(open|run)\command key. |
| 198 // |chrome_exe|: the full path to chrome.exe | 324 // |chrome_exe|: the full path to chrome.exe |
| 199 static string16 GetChromeDelegateCommand(const string16& chrome_exe); | 325 static string16 GetChromeDelegateCommand(const string16& chrome_exe); |
| 200 | 326 |
| 201 // Returns the localized name of Chrome shortcut in |shortcut|. If | |
| 202 // |appended_name| is not empty, it is included in the shortcut name. If | |
| 203 // |alternate| is true, a second localized text that is better suited for | |
| 204 // certain scenarios is used. | |
| 205 static bool GetChromeShortcutName(BrowserDistribution* dist, | |
| 206 bool alternate, | |
| 207 const string16& appended_name, | |
| 208 string16* shortcut); | |
| 209 | |
| 210 // Gets the desktop path for the current user or all users (if system_level | |
| 211 // is true) and returns it in 'path' argument. Return true if successful, | |
| 212 // otherwise returns false. | |
| 213 static bool GetDesktopPath(bool system_level, FilePath* path); | |
| 214 | |
| 215 // Gets the Quick Launch shortcuts path for the current user and | |
| 216 // returns it in 'path' argument. Return true if successful, otherwise | |
| 217 // returns false. If system_level is true this function returns the path | |
| 218 // to Default Users Quick Launch shortcuts path. Adding a shortcut to Default | |
| 219 // User's profile only affects any new user profiles (not existing ones). | |
| 220 static bool GetQuickLaunchPath(bool system_level, FilePath* path); | |
| 221 | |
| 222 // Gets a mapping of all registered browser names (excluding browsers in the | 327 // Gets a mapping of all registered browser names (excluding browsers in the |
| 223 // |dist| distribution) and their reinstall command (which usually sets | 328 // |dist| distribution) and their reinstall command (which usually sets |
| 224 // browser as default). | 329 // browser as default). |
| 225 // Given browsers can be registered in HKCU (as of Win7) and/or in HKLM, this | 330 // Given browsers can be registered in HKCU (as of Win7) and/or in HKLM, this |
| 226 // method looks in both and gives precedence to values in HKCU as per the msdn | 331 // method looks in both and gives precedence to values in HKCU as per the msdn |
| 227 // standard: http://goo.gl/xjczJ. | 332 // standard: http://goo.gl/xjczJ. |
| 228 static void GetRegisteredBrowsers(BrowserDistribution* dist, | 333 static void GetRegisteredBrowsers(BrowserDistribution* dist, |
| 229 std::map<string16, string16>* browsers); | 334 std::map<string16, string16>* browsers); |
| 230 | 335 |
| 231 // Returns the suffix this user's Chrome install is registered with. | 336 // Returns the suffix this user's Chrome install is registered with. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // to default browser entries names that it creates in the registry. | 476 // to default browser entries names that it creates in the registry. |
| 372 // |protocol| The protocol to register as being capable of handling.s | 477 // |protocol| The protocol to register as being capable of handling.s |
| 373 // |elevate_if_not_admin| if true will make this method try alternate methods | 478 // |elevate_if_not_admin| if true will make this method try alternate methods |
| 374 // as described above. | 479 // as described above. |
| 375 static bool RegisterChromeForProtocol(BrowserDistribution* dist, | 480 static bool RegisterChromeForProtocol(BrowserDistribution* dist, |
| 376 const string16& chrome_exe, | 481 const string16& chrome_exe, |
| 377 const string16& unique_suffix, | 482 const string16& unique_suffix, |
| 378 const string16& protocol, | 483 const string16& protocol, |
| 379 bool elevate_if_not_admin); | 484 bool elevate_if_not_admin); |
| 380 | 485 |
| 381 // Remove Chrome shortcut from Desktop. | 486 // Removes installed Chrome shortcut at |location|. |
| 382 // If |shell_change| is CURRENT_USER, the shortcut is removed from the | 487 // |level|: CURRENT_USER to remove the per-user shortcut and SYSTEM_LEVEL to |
| 383 // Desktop folder of current user's profile. | 488 // remove the all-users shortcut. |
| 384 // If |shell_change| is SYSTEM_LEVEL, the shortcut is removed from the | 489 // |shortcut_name|: If non-null, remove the shortcut named |shortcut_name| at |
| 385 // Desktop folder of "All Users" profile. | 490 // location; otherwise remove the default shortcut at |location|. |
| 386 // |options|: bitfield for which the options come from ChromeShortcutOptions. | 491 // If |location| is SHORTCUT_START_MENU the shortcut folder specific to |dist| |
| 387 // Only SHORTCUT_ALTERNATE is a valid option for this function. | 492 // is deleted. |
| 388 static bool RemoveChromeDesktopShortcut(BrowserDistribution* dist, | 493 // Also attempts to unpin the removed shortcut from the taskbar. |
| 389 int shell_change, | 494 // Returns true on success or if no shortcut is found at |location|. |
| 390 uint32 options); | 495 static bool RemoveChromeShortcut(ChromeShortcutLocation location, |
| 391 | 496 BrowserDistribution* dist, |
| 392 // Removes a set of existing Chrome desktop shortcuts. |appended_names| is a | 497 ShellChange level, |
| 393 // list of shortcut file names as obtained from | 498 const string16* shortcut_name); |
| 394 // ShellUtil::GetChromeShortcutName. | |
| 395 static bool RemoveChromeDesktopShortcutsWithAppendedNames( | |
| 396 const std::vector<string16>& appended_names); | |
| 397 | |
| 398 // Remove Chrome shortcut from Quick Launch Bar. | |
| 399 // If shell_change is CURRENT_USER, the shortcut is removed from | |
| 400 // the Quick Launch folder of current user's profile. | |
| 401 // If shell_change is SYSTEM_LEVEL, the shortcut is removed from | |
| 402 // the Quick Launch folder of "Default User" profile. | |
| 403 static bool RemoveChromeQuickLaunchShortcut(BrowserDistribution* dist, | |
| 404 int shell_change); | |
| 405 | 499 |
| 406 // This will remove all secondary tiles from the start screen for |dist|. | 500 // This will remove all secondary tiles from the start screen for |dist|. |
| 407 static void RemoveChromeStartScreenShortcuts(BrowserDistribution* dist, | 501 static void RemoveChromeStartScreenShortcuts(BrowserDistribution* dist, |
| 408 const string16& chrome_exe); | 502 const string16& chrome_exe); |
| 409 | 503 |
| 410 enum ChromeShortcutOptions { | |
| 411 SHORTCUT_NO_OPTIONS = 0, | |
| 412 // Set DualMode property for Windows 8 Metro-enabled shortcuts. | |
| 413 SHORTCUT_DUAL_MODE = 1 << 0, | |
| 414 // Create a new shortcut (overwriting if necessary). | |
| 415 SHORTCUT_CREATE_ALWAYS = 1 << 1, | |
| 416 // Use an alternate application name for the shortcut (e.g. "The Internet"). | |
| 417 // This option is only applied to the Desktop shortcut. | |
| 418 SHORTCUT_ALTERNATE = 1 << 2, | |
| 419 }; | |
| 420 | |
| 421 // Updates shortcut (or creates a new shortcut) at destination given by | |
| 422 // shortcut to a target given by chrome_exe. The arguments are given by | |
| 423 // |arguments| for the target and icon is set based on |icon_path| and | |
| 424 // |icon_index|. If create_new is set to true, the function will create a new | |
| 425 // shortcut if it doesn't exist. | |
| 426 // |options|: bitfield for which the options come from ChromeShortcutOptions. | |
| 427 // If SHORTCUT_CREATE_ALWAYS is not set in |options|, only specified (non- | |
| 428 // null) properties on an existing shortcut will be modified. If the shortcut | |
| 429 // does not exist, this method is a no-op and returns false. | |
| 430 static bool UpdateChromeShortcut(BrowserDistribution* dist, | |
| 431 const string16& chrome_exe, | |
| 432 const string16& shortcut, | |
| 433 const string16& arguments, | |
| 434 const string16& description, | |
| 435 const string16& icon_path, | |
| 436 int icon_index, | |
| 437 uint32 options); | |
| 438 | |
| 439 // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid | 504 // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid |
| 440 // preceded by a dot. | 505 // preceded by a dot. |
| 441 // This is guaranteed to be unique on the machine and 27 characters long | 506 // This is guaranteed to be unique on the machine and 27 characters long |
| 442 // (including the '.'). | 507 // (including the '.'). |
| 443 // This suffix is then meant to be added to all registration that may conflict | 508 // This suffix is then meant to be added to all registration that may conflict |
| 444 // with another user-level Chrome install. | 509 // with another user-level Chrome install. |
| 445 // Note that prior to Chrome 21, the suffix registered used to be the user's | 510 // Note that prior to Chrome 21, the suffix registered used to be the user's |
| 446 // username (see GetOldUserSpecificRegistrySuffix() below). We still honor old | 511 // username (see GetOldUserSpecificRegistrySuffix() below). We still honor old |
| 447 // installs registered that way, but it was wrong because some of the | 512 // installs registered that way, but it was wrong because some of the |
| 448 // characters allowed in a username are not allowed in a ProgId. | 513 // characters allowed in a username are not allowed in a ProgId. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 465 // required by the base32 standard for inputs that aren't a multiple of 5 | 530 // required by the base32 standard for inputs that aren't a multiple of 5 |
| 466 // bytes. | 531 // bytes. |
| 467 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 532 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
| 468 | 533 |
| 469 private: | 534 private: |
| 470 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 535 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 471 }; | 536 }; |
| 472 | 537 |
| 473 | 538 |
| 474 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 539 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |