[email protected] | 8806d3b | 2012-04-13 06:46:34 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ |
| 6 | #define CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ |
[email protected] | 8806d3b | 2012-04-13 06:46:34 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "base/basictypes.h" |
| 11 | #include "base/file_path.h" |
| 12 | #include "chrome/browser/shell_integration.h" |
[email protected] | 98566d7a | 2012-04-17 00:28:56 | [diff] [blame] | 13 | #include "googleurl/src/gurl.h" |
| 14 | |
| 15 | namespace base { |
| 16 | class Environment; |
| 17 | } |
[email protected] | 8806d3b | 2012-04-13 06:46:34 | [diff] [blame] | 18 | |
| 19 | namespace ShellIntegrationLinux { |
| 20 | |
[email protected] | 98566d7a | 2012-04-17 00:28:56 | [diff] [blame] | 21 | // Returns filename of the desktop shortcut used to launch the browser. |
| 22 | std::string GetDesktopName(base::Environment* env); |
| 23 | |
| 24 | bool GetDesktopShortcutTemplate(base::Environment* env, |
| 25 | std::string* output); |
| 26 | |
| 27 | // Returns filename for .desktop file based on |url|, sanitized for security. |
[email protected] | 0b7df36d | 2012-07-11 09:50:47 | [diff] [blame] | 28 | FilePath GetWebShortcutFilename(const GURL& url); |
| 29 | |
| 30 | // Returns filename for .desktop file based on |profile_path| and |
| 31 | // |extension_id|, sanitized for security. |
| 32 | FilePath GetExtensionShortcutFilename(const FilePath& profile_path, |
| 33 | const std::string& extension_id); |
[email protected] | 98566d7a | 2012-04-17 00:28:56 | [diff] [blame] | 34 | |
| 35 | // Returns contents for .desktop file based on |template_contents|, |url| |
| 36 | // and |title|. The |template_contents| should be contents of .desktop file |
| 37 | // used to launch Chrome. |
| 38 | std::string GetDesktopFileContents(const std::string& template_contents, |
| 39 | const std::string& app_name, |
| 40 | const GURL& url, |
| 41 | const std::string& extension_id, |
[email protected] | 98566d7a | 2012-04-17 00:28:56 | [diff] [blame] | 42 | const FilePath& extension_path, |
| 43 | const string16& title, |
[email protected] | 5951c85 | 2012-06-20 00:12:53 | [diff] [blame] | 44 | const std::string& icon_name, |
| 45 | const FilePath& profile_path); |
[email protected] | 98566d7a | 2012-04-17 00:28:56 | [diff] [blame] | 46 | |
[email protected] | 0b7df36d | 2012-07-11 09:50:47 | [diff] [blame] | 47 | |
| 48 | // Create shortcuts on the desktop or in the application menu (as specified by |
| 49 | // |shortcut_info|), for the web page or extension in |shortcut_info|. Use the |
| 50 | // shortcut template contained in |shortcut_template|. |
| 51 | // For extensions, duplicate shortcuts are avoided, so if a requested shortcut |
| 52 | // already exists it is deleted first. |
[email protected] | 98566d7a | 2012-04-17 00:28:56 | [diff] [blame] | 53 | bool CreateDesktopShortcut(const ShellIntegration::ShortcutInfo& shortcut_info, |
| 54 | const std::string& shortcut_template); |
| 55 | |
[email protected] | 0b7df36d | 2012-07-11 09:50:47 | [diff] [blame] | 56 | // Delete any desktop shortcuts on desktop or in the application menu that have |
| 57 | // been added for the extension with |extension_id| in |profile_path|. |
| 58 | void DeleteDesktopShortcuts(const FilePath& profile_path, |
| 59 | const std::string& extension_id); |
| 60 | |
[email protected] | 8806d3b | 2012-04-13 06:46:34 | [diff] [blame] | 61 | } // namespace ShellIntegrationLinux |
| 62 | |
| 63 | #endif // CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ |