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