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_WEB_APPLICATIONS_WEB_APP_H_ | 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "chrome/browser/shell_integration.h" | 15 #include "chrome/browser/shell_integration.h" |
15 #include "chrome/common/web_application_info.h" | 16 #include "chrome/common/web_application_info.h" |
16 | 17 |
| 18 class Profile; |
| 19 |
17 namespace extensions { | 20 namespace extensions { |
18 class Extension; | 21 class Extension; |
19 } | 22 } |
20 | 23 |
21 namespace gfx { | 24 namespace gfx { |
22 class ImageFamily; | 25 class ImageFamily; |
23 } | 26 } |
24 | 27 |
25 namespace web_app { | 28 namespace web_app { |
26 | 29 |
27 // This encodes the cause of shortcut creation as the correct behavior in each | 30 // This encodes the cause of shortcut creation as the correct behavior in each |
28 // case is implementation specific. | 31 // case is implementation specific. |
29 enum ShortcutCreationReason { | 32 enum ShortcutCreationReason { |
30 SHORTCUT_CREATION_BY_USER, | 33 SHORTCUT_CREATION_BY_USER, |
31 SHORTCUT_CREATION_AUTOMATED, | 34 SHORTCUT_CREATION_AUTOMATED, |
32 }; | 35 }; |
33 | 36 |
| 37 typedef base::Callback<void(const ShellIntegration::ShortcutInfo&)> |
| 38 ShortcutInfoCallback; |
| 39 |
| 40 ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( |
| 41 const extensions::Extension* app, |
| 42 Profile* profile); |
| 43 |
| 44 // Fetches the icon for |extension| and calls |callback| with shortcut info |
| 45 // filled out as by UpdateShortcutInfoForApp. |
| 46 void UpdateShortcutInfoAndIconForApp( |
| 47 const extensions::Extension* extension, |
| 48 Profile* profile, |
| 49 const ShortcutInfoCallback& callback); |
| 50 |
34 // Gets the user data directory for given web app. The path for the directory is | 51 // Gets the user data directory for given web app. The path for the directory is |
35 // based on |extension_id|. If |extension_id| is empty then |url| is used | 52 // based on |extension_id|. If |extension_id| is empty then |url| is used |
36 // to construct a unique ID. | 53 // to construct a unique ID. |
37 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 54 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
38 const std::string& extension_id, | 55 const std::string& extension_id, |
39 const GURL& url); | 56 const GURL& url); |
40 | 57 |
41 // Gets the user data directory to use for |extension| located inside | 58 // Gets the user data directory to use for |extension| located inside |
42 // |profile_path|. | 59 // |profile_path|. |
43 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 60 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 163 |
147 // Sanitizes |name| and returns a version of it that is safe to use as an | 164 // Sanitizes |name| and returns a version of it that is safe to use as an |
148 // on-disk file name . | 165 // on-disk file name . |
149 base::FilePath GetSanitizedFileName(const base::string16& name); | 166 base::FilePath GetSanitizedFileName(const base::string16& name); |
150 | 167 |
151 } // namespace internals | 168 } // namespace internals |
152 | 169 |
153 } // namespace web_app | 170 } // namespace web_app |
154 | 171 |
155 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 172 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
OLD | NEW |