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 |
| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 const string16& chrome_exe, | 513 const string16& chrome_exe, |
510 const string16& unique_suffix, | 514 const string16& unique_suffix, |
511 const string16& protocol, | 515 const string16& protocol, |
512 bool elevate_if_not_admin); | 516 bool elevate_if_not_admin); |
513 | 517 |
514 // Removes installed shortcut(s) at |location|. | 518 // Removes installed shortcut(s) at |location|. |
515 // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to | 519 // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to |
516 // remove all-users shortcuts. | 520 // remove all-users shortcuts. |
517 // |target_exe|: Shortcut target exe; shortcuts will only be deleted when | 521 // |target_exe|: Shortcut target exe; shortcuts will only be deleted when |
518 // their target is |target_exe|. | 522 // their target is |target_exe|. |
519 // If |location| is SHORTCUT_LOCATION_START_MENU, the shortcut folder specific | 523 // If |location| is SHORTCUT_LOCATION_START_MENU_CHROME_DIR, the shortcut |
520 // to |dist| is deleted. | 524 // folder specific to |dist| is deleted. |
521 // Returns true if all shortcuts pointing to |target_exe| are successfully | 525 // Returns true if all shortcuts pointing to |target_exe| are successfully |
522 // deleted, including the case where no such shortcuts are found. | 526 // deleted, including the case where no such shortcuts are found. |
523 static bool RemoveShortcuts(ShellUtil::ShortcutLocation location, | 527 static bool RemoveShortcuts(ShellUtil::ShortcutLocation location, |
524 BrowserDistribution* dist, | 528 BrowserDistribution* dist, |
525 ShellChange level, | 529 ShellChange level, |
526 const base::FilePath& target_exe); | 530 const base::FilePath& target_exe); |
527 | 531 |
528 // Applies the updates in |shortcut_properties| to all shortcuts in |location| | 532 // Applies the updates in |shortcut_properties| to all shortcuts in |location| |
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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // required by the base32 standard for inputs that aren't a multiple of 5 | 569 // required by the base32 standard for inputs that aren't a multiple of 5 |
566 // bytes. | 570 // bytes. |
567 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 571 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
568 | 572 |
569 private: | 573 private: |
570 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 574 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
571 }; | 575 }; |
572 | 576 |
573 | 577 |
574 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 578 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |