diff options
Diffstat (limited to 'chrome/installer/util/shell_util.h')
-rw-r--r-- | chrome/installer/util/shell_util.h | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index a00db25..7c8b8fd 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -19,6 +19,12 @@ // that can be used by installer as well as Chrome. class ShellUtil { public: + // Input to any methods that make changes to OS shell. + enum ShellChange { + CURRENT_USER = 0x1, // Make any shell changes only at the user level + SYSTEM_LEVEL = 0x2 // Make any shell changes only at the system level + }; + // Return value of AddChromeToSetAccessDefaults. enum RegisterStatus { SUCCESS, // Registration of Chrome successful (in HKLM) @@ -86,6 +92,30 @@ class ShellUtil { static RegisterStatus AddChromeToSetAccessDefaults( const std::wstring& chrome_exe, bool skip_if_not_admin); + // Create Chrome shortcut on Desktop + // If shell_change is CURRENT_USER, the shortcut is created in the + // Desktop folder of current user's profile. + // If shell_change is SYSTEM_LEVEL, the shortcut is created in the + // Desktop folder of "All Users" profile. + // create_new: If false, will only update the shortcut. If true, the function + // will create a new shortcut if it doesn't exist already. + static bool CreateChromeDesktopShortcut(const std::wstring& chrome_exe, + int shell_change, + bool create_new); + + // Create Chrome shortcut on Quick Launch Bar. + // If shell_change is CURRENT_USER, the shortcut is created in the + // Quick Launch folder of current user's profile. + // If shell_change is SYSTEM_LEVEL, the shortcut is created in the + // Quick Launch folder of "Default User" profile. This will make sure + // that this shortcut will be seen by all the new users logging into the + // system. + // create_new: If false, will only update the shortcut. If true, the function + // will create a new shortcut if it doesn't exist already. + static bool CreateChromeQuickLaunchShortcut(const std::wstring& chrome_exe, + int shell_change, + bool create_new); + // This method appends the Chrome icon index inside chrome.exe to the // chrome.exe path passed in as input, to generate the full path for // Chrome icon that can be used as value for Windows registry keys. @@ -95,14 +125,31 @@ class ShellUtil { // Returns the localized name of Chrome shortcut. static bool GetChromeShortcutName(std::wstring* shortcut); - // Gets the desktop path for the current user and returns it in 'path' - // argument. Return true if successful, otherwise returns false. - static bool GetDesktopPath(std::wstring* path); + // Gets the desktop path for the current user or all users (if system_level + // is true) and returns it in 'path' argument. Return true if successful, + // otherwise returns false. + static bool GetDesktopPath(bool system_level, std::wstring* path); // Gets the Quick Launch shortcuts path for the current user and // returns it in 'path' argument. Return true if successful, otherwise - // returns false. - static bool GetQuickLaunchPath(std::wstring* path); + // returns false. If system_level is true this function returns the path + // to Default Users Quick Launch shortcuts path. Adding a shortcut to Default + // User's profile only affects any new user profiles (not existing ones). + static bool GetQuickLaunchPath(bool system_level, std::wstring* path); + + // Remove Chrome shortcut from Desktop. + // If shell_change is CURRENT_USER, the shortcut is removed from the + // Desktop folder of current user's profile. + // If shell_change is SYSTEM_LEVEL, the shortcut is removed from the + // Desktop folder of "All Users" profile. + static bool RemoveChromeDesktopShortcut(int shell_change); + + // Remove Chrome shortcut from Quick Launch Bar. + // If shell_change is CURRENT_USER, the shortcut is removed from + // the Quick Launch folder of current user's profile. + // If shell_change is SYSTEM_LEVEL, the shortcut is removed from + // the Quick Launch folder of "Default User" profile. + static bool RemoveChromeQuickLaunchShortcut(int shell_change); // Updates shortcut (or creates a new shortcut) at destination given by // shortcut to a target given by chrome_exe. The arguments is left NULL |