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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 // Returns the application name of the program under |dist|. | 237 // Returns the application name of the program under |dist|. |
238 // This application name will be suffixed as is appropriate for the current | 238 // This application name will be suffixed as is appropriate for the current |
239 // install. | 239 // install. |
240 // This is the name that is registered with Default Programs on Windows and | 240 // This is the name that is registered with Default Programs on Windows and |
241 // that should thus be used to "make chrome default" and such. | 241 // that should thus be used to "make chrome default" and such. |
242 static string16 GetApplicationName(BrowserDistribution* dist, | 242 static string16 GetApplicationName(BrowserDistribution* dist, |
243 const string16& chrome_exe); | 243 const string16& chrome_exe); |
244 | 244 |
245 // Returns the AppUserModelId for |dist|. This identifier is unconditionally | 245 // Returns the AppUserModelId for |dist|. This identifier is unconditionally |
246 // suffixed with the user id for user-level installs (in contrast to other | 246 // suffixed with a unique id for this user on user-level installs (in contrast |
247 // registration entries which are suffix as described in | 247 // to other registration entries which are suffixed as described in |
248 // GetCurrentInstallationSuffix() above). | 248 // GetCurrentInstallationSuffix() above). |
249 static string16 GetBrowserModelId(BrowserDistribution* dist, | 249 static string16 GetBrowserModelId(BrowserDistribution* dist, |
250 const string16& chrome_exe); | 250 const string16& chrome_exe); |
251 | 251 |
252 // Returns an AppUserModelId composed of each member of |components| separated | 252 // Returns an AppUserModelId composed of each member of |components| separated |
253 // by dots. | 253 // by dots. |
254 // The returned appid is guaranteed to be no longer than | 254 // The returned appid is guaranteed to be no longer than |
255 // chrome::kMaxAppModelIdLength (some of the components might have been | 255 // chrome::kMaxAppModelIdLength (some of the components might have been |
256 // shortened to enforce this). | 256 // shortened to enforce this). |
257 static string16 BuildAppModelId(const std::vector<string16>& components); | 257 static string16 BuildAppModelId(const std::vector<string16>& components); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // |options|: bitfield for which the options come from ChromeShortcutOptions. | 398 // |options|: bitfield for which the options come from ChromeShortcutOptions. |
399 static bool UpdateChromeShortcut(BrowserDistribution* dist, | 399 static bool UpdateChromeShortcut(BrowserDistribution* dist, |
400 const string16& chrome_exe, | 400 const string16& chrome_exe, |
401 const string16& shortcut, | 401 const string16& shortcut, |
402 const string16& arguments, | 402 const string16& arguments, |
403 const string16& description, | 403 const string16& description, |
404 const string16& icon_path, | 404 const string16& icon_path, |
405 int icon_index, | 405 int icon_index, |
406 uint32 options); | 406 uint32 options); |
407 | 407 |
| 408 // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid |
| 409 // preceded by a dot. |
| 410 // This is guaranteed to be unique on the machine and 27 characters long |
| 411 // (including the '.'). |
| 412 // This suffix is then meant to be added to all registration that may conflict |
| 413 // with another user-level Chrome install. |
| 414 // Note that prior to Chrome 21, the suffix registered used to be the user's |
| 415 // username (see GetOldUserSpecificRegistrySuffix() below). We still honor old |
| 416 // installs registered that way, but it was wrong because some of the |
| 417 // characters allowed in a username are not allowed in a ProgId. |
| 418 // Returns true unless the OS call to retrieve the username fails. |
| 419 // NOTE: Only the installer should use this suffix directly. Other callers |
| 420 // should call GetCurrentInstallationSuffix(). |
| 421 static bool GetUserSpecificRegistrySuffix(string16* suffix); |
| 422 |
| 423 // Sets |suffix| to this user's username preceded by a dot. This suffix should |
| 424 // only be used to support legacy installs that used this suffixing |
| 425 // style. |
| 426 // Returns true unless the OS call to retrieve the username fails. |
| 427 // NOTE: Only the installer should use this suffix directly. Other callers |
| 428 // should call GetCurrentInstallationSuffix(). |
| 429 static bool GetOldUserSpecificRegistrySuffix(string16* suffix); |
| 430 |
| 431 // Returns the base32 encoding (using the [A-Z2-7] alphabet) of |bytes|. |
| 432 // |size| is the length of |bytes|. |
| 433 // Note: This method does not suffix the output with '=' signs as technically |
| 434 // required by the base32 standard for inputs that aren't a multiple of 5 |
| 435 // bytes. |
| 436 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
| 437 |
408 private: | 438 private: |
409 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 439 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
410 }; | 440 }; |
411 | 441 |
412 | 442 |
413 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 443 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |