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 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ShortcutInfo ShortcutInfoForExtensionAndProfile( | 115 ShortcutInfo ShortcutInfoForExtensionAndProfile( |
116 const extensions::Extension* app, | 116 const extensions::Extension* app, |
117 Profile* profile); | 117 Profile* profile); |
118 | 118 |
119 // Fetches the icon for |extension| and calls |callback| with shortcut info | 119 // Fetches the icon for |extension| and calls |callback| with shortcut info |
120 // filled out as by UpdateShortcutInfoForApp. | 120 // filled out as by UpdateShortcutInfoForApp. |
121 void UpdateShortcutInfoAndIconForApp(const extensions::Extension* extension, | 121 void UpdateShortcutInfoAndIconForApp(const extensions::Extension* extension, |
122 Profile* profile, | 122 Profile* profile, |
123 const ShortcutInfoCallback& callback); | 123 const ShortcutInfoCallback& callback); |
124 | 124 |
| 125 // Whether to create a shortcut for this type of extension. |
| 126 bool ShouldCreateShortcutFor(Profile* profile, |
| 127 const extensions::Extension* extension); |
| 128 |
125 // Gets the user data directory for given web app. The path for the directory is | 129 // Gets the user data directory for given web app. The path for the directory is |
126 // based on |extension_id|. If |extension_id| is empty then |url| is used | 130 // based on |extension_id|. If |extension_id| is empty then |url| is used |
127 // to construct a unique ID. | 131 // to construct a unique ID. |
128 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 132 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
129 const std::string& extension_id, | 133 const std::string& extension_id, |
130 const GURL& url); | 134 const GURL& url); |
131 | 135 |
132 // Gets the user data directory to use for |extension| located inside | 136 // Gets the user data directory to use for |extension| located inside |
133 // |profile_path|. | 137 // |profile_path|. |
134 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 138 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
(...skipping 30 matching lines...) Expand all Loading... |
165 // extension. | 169 // extension. |
166 void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app); | 170 void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app); |
167 | 171 |
168 // Updates shortcuts for web application based on given shortcut data. This | 172 // Updates shortcuts for web application based on given shortcut data. This |
169 // refreshes existing shortcuts and their icons, but does not create new ones. | 173 // refreshes existing shortcuts and their icons, but does not create new ones. |
170 // |old_app_title| contains the title of the app prior to this update. | 174 // |old_app_title| contains the title of the app prior to this update. |
171 void UpdateAllShortcuts(const base::string16& old_app_title, | 175 void UpdateAllShortcuts(const base::string16& old_app_title, |
172 Profile* profile, | 176 Profile* profile, |
173 const extensions::Extension* app); | 177 const extensions::Extension* app); |
174 | 178 |
| 179 // Updates shortcuts for all apps in this profile. This is expected to be called |
| 180 // on the UI thread. |
| 181 void UpdateShortcutsForAllApps(Profile* profile, |
| 182 const base::Closure& callback); |
| 183 |
175 // Returns true if given url is a valid web app url. | 184 // Returns true if given url is a valid web app url. |
176 bool IsValidUrl(const GURL& url); | 185 bool IsValidUrl(const GURL& url); |
177 | 186 |
178 #if defined(TOOLKIT_VIEWS) | 187 #if defined(TOOLKIT_VIEWS) |
179 // Extracts icons info from web app data. Take only square shaped icons and | 188 // Extracts icons info from web app data. Take only square shaped icons and |
180 // sort them from smallest to largest. | 189 // sort them from smallest to largest. |
181 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; | 190 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; |
182 void GetIconsInfo(const WebApplicationInfo& app_info, IconInfoList* icons); | 191 void GetIconsInfo(const WebApplicationInfo& app_info, IconInfoList* icons); |
183 #endif | 192 #endif |
184 | 193 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 249 |
241 // Sanitizes |name| and returns a version of it that is safe to use as an | 250 // Sanitizes |name| and returns a version of it that is safe to use as an |
242 // on-disk file name . | 251 // on-disk file name . |
243 base::FilePath GetSanitizedFileName(const base::string16& name); | 252 base::FilePath GetSanitizedFileName(const base::string16& name); |
244 | 253 |
245 } // namespace internals | 254 } // namespace internals |
246 | 255 |
247 } // namespace web_app | 256 } // namespace web_app |
248 | 257 |
249 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 258 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
OLD | NEW |