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 26 matching lines...) Expand all Loading... | |
37 UNKNOWN_DEFAULT, | 37 UNKNOWN_DEFAULT, |
38 NOT_DEFAULT, | 38 NOT_DEFAULT, |
39 IS_DEFAULT, | 39 IS_DEFAULT, |
40 }; | 40 }; |
41 | 41 |
42 // Typical shortcut directories. Resolved in GetShortcutPath(). | 42 // Typical shortcut directories. Resolved in GetShortcutPath(). |
43 // Also used in ShortcutLocationIsSupported(). | 43 // Also used in ShortcutLocationIsSupported(). |
44 enum ShortcutLocation { | 44 enum ShortcutLocation { |
45 SHORTCUT_LOCATION_DESKTOP, | 45 SHORTCUT_LOCATION_DESKTOP, |
46 SHORTCUT_LOCATION_QUICK_LAUNCH, | 46 SHORTCUT_LOCATION_QUICK_LAUNCH, |
47 SHORTCUT_LOCATION_START_MENU, | 47 SHORTCUT_LOCATION_START_MENU_ROOT, |
48 SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | |
49 SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | |
48 SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 + | 50 SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 + |
49 SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 + | 51 SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 + |
50 }; | 52 }; |
51 | 53 |
52 enum ShortcutOperation { | 54 enum ShortcutOperation { |
53 // Create a new shortcut (overwriting if necessary). | 55 // Create a new shortcut (overwriting if necessary). |
54 SHELL_SHORTCUT_CREATE_ALWAYS, | 56 SHELL_SHORTCUT_CREATE_ALWAYS, |
55 // Create the per-user shortcut only if its system-level equivalent (with | 57 // Create the per-user shortcut only if its system-level equivalent (with |
56 // the same name) is not present. | 58 // the same name) is not present. |
57 SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL, | 59 SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 BrowserDistribution* dist, | 316 BrowserDistribution* dist, |
315 ShellChange level, | 317 ShellChange level, |
316 base::FilePath* path); | 318 base::FilePath* path); |
317 | 319 |
318 // Updates shortcut in |location| (or creates it if |options| specify | 320 // Updates shortcut in |location| (or creates it if |options| specify |
319 // SHELL_SHORTCUT_CREATE_ALWAYS). | 321 // SHELL_SHORTCUT_CREATE_ALWAYS). |
320 // |dist| gives the type of browser distribution currently in use. | 322 // |dist| gives the type of browser distribution currently in use. |
321 // |properties| and |operation| affect this method as described on their | 323 // |properties| and |operation| affect this method as described on their |
322 // invidividual definitions above. | 324 // invidividual definitions above. |
323 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, | 325 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, |
324 // SHORTCUT_LOCATION_QUICK_LAUNCH, or SHORTCUT_LOCATION_START_MENU. | 326 // SHORTCUT_LOCATION_QUICK_LAUNCH, SHORTCUT_LOCATION_START_MENU_ROOT, |
327 // SHORTCUT_LOCATION_START_MENU_CHROME_DIR or | |
huangs
2013/05/15 02:33:46
Add "," back; I think Oxford comma improves readab
gab
2013/05/15 21:26:38
+1
calamity
2013/08/27 07:59:35
Done.
| |
328 // SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR. | |
325 static bool CreateOrUpdateShortcut( | 329 static bool CreateOrUpdateShortcut( |
326 ShellUtil::ShortcutLocation location, | 330 ShellUtil::ShortcutLocation location, |
327 BrowserDistribution* dist, | 331 BrowserDistribution* dist, |
328 const ShellUtil::ShortcutProperties& properties, | 332 const ShellUtil::ShortcutProperties& properties, |
329 ShellUtil::ShortcutOperation operation); | 333 ShellUtil::ShortcutOperation operation); |
330 | 334 |
331 // Returns the string "|icon_path|,|icon_index|" (see, for example, | 335 // Returns the string "|icon_path|,|icon_index|" (see, for example, |
332 // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx). | 336 // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx). |
333 static string16 FormatIconLocation(const string16& icon_path, int icon_index); | 337 static string16 FormatIconLocation(const string16& icon_path, int icon_index); |
334 | 338 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 // that target |target_exe|. | 533 // that target |target_exe|. |
530 // Returns true if all shortcuts pointing to |target_exe| are successfully | 534 // Returns true if all shortcuts pointing to |target_exe| are successfully |
531 // updated, including the case where no such shortcuts are found. | 535 // updated, including the case where no such shortcuts are found. |
532 static bool UpdateShortcuts( | 536 static bool UpdateShortcuts( |
533 ShellUtil::ShortcutLocation location, | 537 ShellUtil::ShortcutLocation location, |
534 BrowserDistribution* dist, | 538 BrowserDistribution* dist, |
535 ShellChange level, | 539 ShellChange level, |
536 const base::FilePath& target_exe, | 540 const base::FilePath& target_exe, |
537 const ShellUtil::ShortcutProperties& properties); | 541 const ShellUtil::ShortcutProperties& properties); |
538 | 542 |
543 | |
huangs
2013/05/15 02:33:46
Delete extra line.
calamity
2013/08/27 07:59:35
Done.
| |
539 // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid | 544 // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid |
540 // preceded by a dot. | 545 // preceded by a dot. |
541 // This is guaranteed to be unique on the machine and 27 characters long | 546 // This is guaranteed to be unique on the machine and 27 characters long |
542 // (including the '.'). | 547 // (including the '.'). |
543 // This suffix is then meant to be added to all registration that may conflict | 548 // This suffix is then meant to be added to all registration that may conflict |
544 // with another user-level Chrome install. | 549 // with another user-level Chrome install. |
545 // Note that prior to Chrome 21, the suffix registered used to be the user's | 550 // Note that prior to Chrome 21, the suffix registered used to be the user's |
546 // username (see GetOldUserSpecificRegistrySuffix() below). We still honor old | 551 // username (see GetOldUserSpecificRegistrySuffix() below). We still honor old |
547 // installs registered that way, but it was wrong because some of the | 552 // installs registered that way, but it was wrong because some of the |
548 // characters allowed in a username are not allowed in a ProgId. | 553 // characters allowed in a username are not allowed in a ProgId. |
(...skipping 16 matching lines...) Expand all Loading... | |
565 // required by the base32 standard for inputs that aren't a multiple of 5 | 570 // required by the base32 standard for inputs that aren't a multiple of 5 |
566 // bytes. | 571 // bytes. |
567 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 572 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
568 | 573 |
569 private: | 574 private: |
570 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 575 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
571 }; | 576 }; |
572 | 577 |
573 | 578 |
574 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 579 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |