| 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 #ifndef CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ | 5 #ifndef CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ | 
| 6 #define CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ | 6 #define CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" | 
| 12 #include "chrome/browser/shell_integration.h" | 12 #include "chrome/browser/web_applications/web_app.h" | 
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" | 
| 14 | 14 | 
| 15 namespace base { | 15 namespace base { | 
| 16 class CommandLine; | 16 class CommandLine; | 
| 17 class Environment; | 17 class Environment; | 
| 18 } | 18 } | 
| 19 | 19 | 
| 20 namespace ShellIntegrationLinux { | 20 namespace ShellIntegrationLinux { | 
| 21 | 21 | 
| 22 // Get the path to write user-specific application data files to, as specified | 22 // Get the path to write user-specific application data files to, as specified | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 41 std::string GetDesktopName(base::Environment* env); | 41 std::string GetDesktopName(base::Environment* env); | 
| 42 | 42 | 
| 43 // Returns name of the browser icon (without a path or file extension). | 43 // Returns name of the browser icon (without a path or file extension). | 
| 44 std::string GetIconName(); | 44 std::string GetIconName(); | 
| 45 | 45 | 
| 46 // Returns the set of locations in which shortcuts are installed for the | 46 // Returns the set of locations in which shortcuts are installed for the | 
| 47 // extension with |extension_id| in |profile_path|. | 47 // extension with |extension_id| in |profile_path|. | 
| 48 // This searches the file system for .desktop files in appropriate locations. A | 48 // This searches the file system for .desktop files in appropriate locations. A | 
| 49 // shortcut with NoDisplay=true causes hidden to become true, instead of | 49 // shortcut with NoDisplay=true causes hidden to become true, instead of | 
| 50 // creating at APP_MENU_LOCATIONS_SUBDIR_CHROMEAPPS. | 50 // creating at APP_MENU_LOCATIONS_SUBDIR_CHROMEAPPS. | 
| 51 ShellIntegration::ShortcutLocations GetExistingShortcutLocations( | 51 web_app::ShortcutLocations GetExistingShortcutLocations( | 
| 52     base::Environment* env, | 52     base::Environment* env, | 
| 53     const base::FilePath& profile_path, | 53     const base::FilePath& profile_path, | 
| 54     const std::string& extension_id); | 54     const std::string& extension_id); | 
| 55 | 55 | 
| 56 // Version of GetExistingShortcutLocations which takes an explicit path | 56 // Version of GetExistingShortcutLocations which takes an explicit path | 
| 57 // to the user's desktop directory. Useful for testing. | 57 // to the user's desktop directory. Useful for testing. | 
| 58 // If |desktop_path| is empty, the desktop is not searched. | 58 // If |desktop_path| is empty, the desktop is not searched. | 
| 59 ShellIntegration::ShortcutLocations GetExistingShortcutLocations( | 59 web_app::ShortcutLocations GetExistingShortcutLocations( | 
| 60     base::Environment* env, | 60     base::Environment* env, | 
| 61     const base::FilePath& profile_path, | 61     const base::FilePath& profile_path, | 
| 62     const std::string& extension_id, | 62     const std::string& extension_id, | 
| 63     const base::FilePath& desktop_path); | 63     const base::FilePath& desktop_path); | 
| 64 | 64 | 
| 65 // Returns the contents of an existing .desktop file installed in the system. | 65 // Returns the contents of an existing .desktop file installed in the system. | 
| 66 // Searches the "applications" subdirectory of each XDG data directory for a | 66 // Searches the "applications" subdirectory of each XDG data directory for a | 
| 67 // file named |desktop_filename|. If the file is found, populates |output| with | 67 // file named |desktop_filename|. If the file is found, populates |output| with | 
| 68 // its contents and returns true. Else, returns false. | 68 // its contents and returns true. Else, returns false. | 
| 69 bool GetExistingShortcutContents(base::Environment* env, | 69 bool GetExistingShortcutContents(base::Environment* env, | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 109 // Returns contents for .directory file named |title| with icon |icon_name|. If | 109 // Returns contents for .directory file named |title| with icon |icon_name|. If | 
| 110 // |icon_name| is empty, will use the Chrome icon. | 110 // |icon_name| is empty, will use the Chrome icon. | 
| 111 std::string GetDirectoryFileContents(const base::string16& title, | 111 std::string GetDirectoryFileContents(const base::string16& title, | 
| 112                                      const std::string& icon_name); | 112                                      const std::string& icon_name); | 
| 113 | 113 | 
| 114 // Create shortcuts on the desktop or in the application menu (as specified by | 114 // Create shortcuts on the desktop or in the application menu (as specified by | 
| 115 // |shortcut_info|), for the web page or extension in |shortcut_info|. | 115 // |shortcut_info|), for the web page or extension in |shortcut_info|. | 
| 116 // For extensions, duplicate shortcuts are avoided, so if a requested shortcut | 116 // For extensions, duplicate shortcuts are avoided, so if a requested shortcut | 
| 117 // already exists it is deleted first. | 117 // already exists it is deleted first. | 
| 118 bool CreateDesktopShortcut( | 118 bool CreateDesktopShortcut( | 
| 119     const ShellIntegration::ShortcutInfo& shortcut_info, | 119     const web_app::ShortcutInfo& shortcut_info, | 
| 120     const ShellIntegration::ShortcutLocations& creation_locations); | 120     const web_app::ShortcutLocations& creation_locations); | 
| 121 | 121 | 
| 122 // Create shortcuts in the application menu for the app launcher. Duplicate | 122 // Create shortcuts in the application menu for the app launcher. Duplicate | 
| 123 // shortcuts are avoided, so if a requested shortcut already exists it is | 123 // shortcuts are avoided, so if a requested shortcut already exists it is | 
| 124 // deleted first. Also creates the icon required by the shortcut. | 124 // deleted first. Also creates the icon required by the shortcut. | 
| 125 bool CreateAppListDesktopShortcut(const std::string& wm_class, | 125 bool CreateAppListDesktopShortcut(const std::string& wm_class, | 
| 126                                   const std::string& title); | 126                                   const std::string& title); | 
| 127 | 127 | 
| 128 // Delete any desktop shortcuts on desktop or in the application menu that have | 128 // Delete any desktop shortcuts on desktop or in the application menu that have | 
| 129 // been added for the extension with |extension_id| in |profile_path|. | 129 // been added for the extension with |extension_id| in |profile_path|. | 
| 130 void DeleteDesktopShortcuts(const base::FilePath& profile_path, | 130 void DeleteDesktopShortcuts(const base::FilePath& profile_path, | 
| 131                             const std::string& extension_id); | 131                             const std::string& extension_id); | 
| 132 | 132 | 
| 133 // Delete any desktop shortcuts on desktop or in the application menu that have | 133 // Delete any desktop shortcuts on desktop or in the application menu that have | 
| 134 // for the profile in |profile_path|. | 134 // for the profile in |profile_path|. | 
| 135 void DeleteAllDesktopShortcuts(const base::FilePath& profile_path); | 135 void DeleteAllDesktopShortcuts(const base::FilePath& profile_path); | 
| 136 | 136 | 
| 137 }  // namespace ShellIntegrationLinux | 137 }  // namespace ShellIntegrationLinux | 
| 138 | 138 | 
| 139 #endif  // CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ | 139 #endif  // CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ | 
| OLD | NEW | 
|---|