Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/web_applications/web_app.h

Issue 263403002: Replace OnceOffCreateShortcuts with UpdateShortcutsForAllAppsIfNeeded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // extension. 170 // extension.
171 void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app); 171 void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app);
172 172
173 // Updates shortcuts for web application based on given shortcut data. This 173 // Updates shortcuts for web application based on given shortcut data. This
174 // refreshes existing shortcuts and their icons, but does not create new ones. 174 // refreshes existing shortcuts and their icons, but does not create new ones.
175 // |old_app_title| contains the title of the app prior to this update. 175 // |old_app_title| contains the title of the app prior to this update.
176 void UpdateAllShortcuts(const base::string16& old_app_title, 176 void UpdateAllShortcuts(const base::string16& old_app_title,
177 Profile* profile, 177 Profile* profile,
178 const extensions::Extension* app); 178 const extensions::Extension* app);
179 179
180 // Updates shortcuts for all apps in this profile.
181 void UpdateShortcutsForAllApps(Profile* profile);
182
180 // Returns true if given url is a valid web app url. 183 // Returns true if given url is a valid web app url.
181 bool IsValidUrl(const GURL& url); 184 bool IsValidUrl(const GURL& url);
182 185
183 #if defined(TOOLKIT_VIEWS) 186 #if defined(TOOLKIT_VIEWS)
184 // Extracts icons info from web app data. Take only square shaped icons and 187 // Extracts icons info from web app data. Take only square shaped icons and
185 // sort them from smallest to largest. 188 // sort them from smallest to largest.
186 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; 189 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList;
187 void GetIconsInfo(const WebApplicationInfo& app_info, 190 void GetIconsInfo(const WebApplicationInfo& app_info,
188 IconInfoList* icons); 191 IconInfoList* icons);
189 #endif 192 #endif
190 193
191 #if defined(OS_LINUX) 194 #if defined(OS_LINUX)
192 // Windows that correspond to web apps need to have a deterministic (and 195 // Windows that correspond to web apps need to have a deterministic (and
193 // different) WMClass than normal chrome windows so the window manager groups 196 // different) WMClass than normal chrome windows so the window manager groups
194 // them as a separate application. 197 // them as a separate application.
195 std::string GetWMClassFromAppName(std::string app_name); 198 std::string GetWMClassFromAppName(std::string app_name);
196 #endif 199 #endif
197 200
198 namespace internals { 201 namespace internals {
199 202
203 typedef base::Callback<void(Profile*, const extensions::Extension*)>
204 ShortcutOperationCallback;
205
206 // Resolves |profile_path| and |app_id| into Profile* and Extension*.
207 void CallForProfileAndAppId(
208 const base::FilePath& profile_path,
209 const std::string app_id,
210 const ShortcutOperationCallback& callback);
211
200 #if defined(OS_WIN) 212 #if defined(OS_WIN)
201 // Returns the Windows user-level shortcut paths that are specified in 213 // Returns the Windows user-level shortcut paths that are specified in
202 // |creation_locations|. 214 // |creation_locations|.
203 std::vector<base::FilePath> GetShortcutPaths( 215 std::vector<base::FilePath> GetShortcutPaths(
204 const web_app::ShortcutLocations& creation_locations); 216 const web_app::ShortcutLocations& creation_locations);
205 #endif 217 #endif
206 218
207 // Creates a shortcut. Must be called on the file thread. This is used to 219 // Creates a shortcut. Must be called on the file thread. This is used to
208 // implement CreateShortcuts() above, and can also be used directly from the 220 // implement CreateShortcuts() above, and can also be used directly from the
209 // file thread. |shortcut_info| contains info about the shortcut to create, and 221 // file thread. |shortcut_info| contains info about the shortcut to create, and
(...skipping 29 matching lines...) Expand all
239 void UpdatePlatformShortcuts( 251 void UpdatePlatformShortcuts(
240 const base::FilePath& shortcut_data_path, 252 const base::FilePath& shortcut_data_path,
241 const base::string16& old_app_title, 253 const base::string16& old_app_title,
242 const web_app::ShortcutInfo& shortcut_info, 254 const web_app::ShortcutInfo& shortcut_info,
243 const extensions::FileHandlersInfo& file_handlers_info); 255 const extensions::FileHandlersInfo& file_handlers_info);
244 256
245 // Delete all the shortcuts for an entire profile. 257 // Delete all the shortcuts for an entire profile.
246 // This is executed on the FILE thread. 258 // This is executed on the FILE thread.
247 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path); 259 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path);
248 260
261 // Checks all shortcuts for a profile and deletes/updates them as necessary.
262 void UpdateShortcutsForAllAppsForProfile(const base::FilePath& profile_path,
263 const std::set<std::string>& app_ids);
264
249 // Sanitizes |name| and returns a version of it that is safe to use as an 265 // Sanitizes |name| and returns a version of it that is safe to use as an
250 // on-disk file name . 266 // on-disk file name .
251 base::FilePath GetSanitizedFileName(const base::string16& name); 267 base::FilePath GetSanitizedFileName(const base::string16& name);
252 268
253 } // namespace internals 269 } // namespace internals
254 270
255 } // namespace web_app 271 } // namespace web_app
256 272
257 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ 273 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698