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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 IS_DEFAULT, | 47 IS_DEFAULT, |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Typical shortcut directories. Resolved in GetShortcutPath(). | 50 // Typical shortcut directories. Resolved in GetShortcutPath(). |
| 51 // Also used in ShortcutLocationIsSupported(). | 51 // Also used in ShortcutLocationIsSupported(). |
| 52 enum ShortcutLocation { | 52 enum ShortcutLocation { |
| 53 SHORTCUT_LOCATION_FIRST = 0, | 53 SHORTCUT_LOCATION_FIRST = 0, |
| 54 SHORTCUT_LOCATION_DESKTOP = SHORTCUT_LOCATION_FIRST, | 54 SHORTCUT_LOCATION_DESKTOP = SHORTCUT_LOCATION_FIRST, |
| 55 SHORTCUT_LOCATION_QUICK_LAUNCH, | 55 SHORTCUT_LOCATION_QUICK_LAUNCH, |
| 56 SHORTCUT_LOCATION_START_MENU_ROOT, | 56 SHORTCUT_LOCATION_START_MENU_ROOT, |
| 57 SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 57 SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, // now placed in root |
| 58 SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | 58 SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, |
| 59 SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 + | 59 SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 + |
| 60 SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 + | 60 SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 + |
| 61 NUM_SHORTCUT_LOCATIONS | 61 NUM_SHORTCUT_LOCATIONS |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 enum ShortcutOperation { | 64 enum ShortcutOperation { |
| 65 // Create a new shortcut (overwriting if necessary). | 65 // Create a new shortcut (overwriting if necessary). |
| 66 SHELL_SHORTCUT_CREATE_ALWAYS, | 66 SHELL_SHORTCUT_CREATE_ALWAYS, |
| 67 // Create the per-user shortcut only if its system-level equivalent (with | 67 // Create the per-user shortcut only if its system-level equivalent (with |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 | 323 |
| 324 // Sets |path| to the path for a shortcut at the |location| desired for the | 324 // Sets |path| to the path for a shortcut at the |location| desired for the |
| 325 // given |level| (CURRENT_USER for per-user path and SYSTEM_LEVEL for | 325 // given |level| (CURRENT_USER for per-user path and SYSTEM_LEVEL for |
| 326 // all-users path). | 326 // all-users path). |
| 327 // Returns false on failure. | 327 // Returns false on failure. |
| 328 static bool GetShortcutPath(ShellUtil::ShortcutLocation location, | 328 static bool GetShortcutPath(ShellUtil::ShortcutLocation location, |
| 329 BrowserDistribution* dist, | 329 BrowserDistribution* dist, |
| 330 ShellChange level, | 330 ShellChange level, |
| 331 base::FilePath* path); | 331 base::FilePath* path); |
| 332 | 332 |
| 333 // Move an existing shortcut from |old_location| to |new_location| for the | |
| 334 // set |shortcut_level|. | |
|
grt (UTC plus 2)
2015/10/19 17:28:45
please add to the comment that the folder at |old_
bcwhite
2015/10/20 16:02:13
Done.
| |
| 335 static bool ShellUtil::MoveExistingShortcut( | |
|
grt (UTC plus 2)
2015/10/19 17:28:45
could you add a unittest for this?
grt (UTC plus 2)
2015/10/19 17:28:45
remove ShellUtil::
bcwhite
2015/10/20 16:02:13
Done.
bcwhite
2015/10/20 16:02:13
Done. (here and elsewhere)
| |
| 336 ShellUtil::ShortcutLocation old_location, | |
| 337 ShellUtil::ShortcutLocation new_location, | |
| 338 BrowserDistribution* dist, | |
| 339 ShellUtil::ShellChange shortcut_level, | |
| 340 const ShellUtil::ShortcutProperties& properties); | |
| 341 | |
| 333 // Updates shortcut in |location| (or creates it if |options| specify | 342 // Updates shortcut in |location| (or creates it if |options| specify |
| 334 // SHELL_SHORTCUT_CREATE_ALWAYS). | 343 // SHELL_SHORTCUT_CREATE_ALWAYS). |
| 335 // |dist| gives the type of browser distribution currently in use. | 344 // |dist| gives the type of browser distribution currently in use. |
| 336 // |properties| and |operation| affect this method as described on their | 345 // |properties| and |operation| affect this method as described on their |
| 337 // invidividual definitions above. | 346 // invidividual definitions above. |
| 338 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, | 347 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, |
| 339 // SHORTCUT_LOCATION_QUICK_LAUNCH, SHORTCUT_LOCATION_START_MENU_ROOT, | 348 // SHORTCUT_LOCATION_QUICK_LAUNCH, SHORTCUT_LOCATION_START_MENU_ROOT, |
| 340 // SHORTCUT_LOCATION_START_MENU_CHROME_DIR, or | 349 // SHORTCUT_LOCATION_START_MENU_CHROME_DIR, or |
| 341 // SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR. | 350 // SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR. |
| 342 static bool CreateOrUpdateShortcut( | 351 static bool CreateOrUpdateShortcut( |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 647 // application, as given to AddFileAssociations. All information associated | 656 // application, as given to AddFileAssociations. All information associated |
| 648 // with this name will be deleted. | 657 // with this name will be deleted. |
| 649 static bool DeleteFileAssociations(const base::string16& prog_id); | 658 static bool DeleteFileAssociations(const base::string16& prog_id); |
| 650 | 659 |
| 651 private: | 660 private: |
| 652 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 661 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 653 }; | 662 }; |
| 654 | 663 |
| 655 | 664 |
| 656 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 665 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |