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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 base::string16 title; | 51 base::string16 title; |
52 base::string16 description; | 52 base::string16 description; |
53 base::FilePath extension_path; | 53 base::FilePath extension_path; |
54 gfx::ImageFamily favicon; | 54 gfx::ImageFamily favicon; |
55 base::FilePath profile_path; | 55 base::FilePath profile_path; |
56 std::string profile_name; | 56 std::string profile_name; |
57 std::string version_for_display; | 57 std::string version_for_display; |
58 | 58 |
59 private: | 59 private: |
60 // ShortcutInfo must not be copied; generally it is passed around via | 60 // ShortcutInfo must not be copied; generally it is passed around via |
61 // scoped_ptrs. This is to allow passing ShortcutInfos between threads, | 61 // unique_ptr. Since ImageFamily has a non-thread-safe reference count in |
62 // despite ImageFamily having a non-thread-safe reference count. | 62 // its member and is bound to UI thread, destroy ShortcutInfo instance |
63 // on UI thread. | |
63 DISALLOW_COPY_AND_ASSIGN(ShortcutInfo); | 64 DISALLOW_COPY_AND_ASSIGN(ShortcutInfo); |
64 }; | 65 }; |
65 | 66 |
66 // This specifies a folder in the system applications menu (e.g the Start Menu | 67 // This specifies a folder in the system applications menu (e.g the Start Menu |
67 // on Windows). | 68 // on Windows). |
68 // | 69 // |
69 // These represent the applications menu root, the "Google Chrome" folder and | 70 // These represent the applications menu root, the "Google Chrome" folder and |
70 // the "Chrome Apps" folder respectively. | 71 // the "Chrome Apps" folder respectively. |
71 // | 72 // |
72 // APP_MENU_LOCATION_HIDDEN specifies a shortcut that is used to register the | 73 // APP_MENU_LOCATION_HIDDEN specifies a shortcut that is used to register the |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 std::vector<base::FilePath> GetShortcutPaths( | 223 std::vector<base::FilePath> GetShortcutPaths( |
223 const ShortcutLocations& creation_locations); | 224 const ShortcutLocations& creation_locations); |
224 #endif | 225 #endif |
225 | 226 |
226 // Implemented for each platform, does the platform specific parts of creating | 227 // Implemented for each platform, does the platform specific parts of creating |
227 // shortcuts. Used internally by CreateShortcuts methods. | 228 // shortcuts. Used internally by CreateShortcuts methods. |
228 // |shortcut_data_path| is where to store any resources created for the | 229 // |shortcut_data_path| is where to store any resources created for the |
229 // shortcut, and is also used as the UserDataDir for platform app shortcuts. | 230 // shortcut, and is also used as the UserDataDir for platform app shortcuts. |
230 // |shortcut_info| contains info about the shortcut to create, and | 231 // |shortcut_info| contains info about the shortcut to create, and |
231 // |creation_locations| contains information about where to create them. | 232 // |creation_locations| contains information about where to create them. |
232 bool CreatePlatformShortcuts( | 233 bool CreatePlatformShortcuts(const base::FilePath& shortcut_data_path, |
233 const base::FilePath& shortcut_data_path, | 234 ShortcutInfo* shortcut_info, |
Matt Giuca
2017/03/01 08:49:55
This should take a const ShortcutInfo&, not a poin
tapted
2017/03/01 10:38:57
Yah - I think base::Bind requires types passed to
tzik
2017/03/01 12:34:04
It's not common, but we have base::ConstRef() wrap
| |
234 std::unique_ptr<ShortcutInfo> shortcut_info, | 235 const ShortcutLocations& creation_locations, |
235 const ShortcutLocations& creation_locations, | 236 ShortcutCreationReason creation_reason); |
236 ShortcutCreationReason creation_reason); | |
237 | 237 |
238 // Delete all the shortcuts we have added for this extension. This is the | 238 // Delete all the shortcuts we have added for this extension. This is the |
239 // platform specific implementation of the DeleteAllShortcuts function, and | 239 // platform specific implementation of the DeleteAllShortcuts function, and |
240 // is executed on the FILE thread. | 240 // is executed on the FILE thread. |
241 void DeletePlatformShortcuts(const base::FilePath& shortcut_data_path, | 241 void DeletePlatformShortcuts(const base::FilePath& shortcut_data_path, |
242 std::unique_ptr<ShortcutInfo> shortcut_info); | 242 ShortcutInfo* shortcut_info); |
Matt Giuca
2017/03/01 08:49:55
Same.
tzik
2017/03/01 12:34:04
Done.
| |
243 | 243 |
244 // Updates all the shortcuts we have added for this extension. This is the | 244 // Updates all the shortcuts we have added for this extension. This is the |
245 // platform specific implementation of the UpdateAllShortcuts function, and | 245 // platform specific implementation of the UpdateAllShortcuts function, and |
246 // is executed on the FILE thread. | 246 // is executed on the FILE thread. |
247 void UpdatePlatformShortcuts(const base::FilePath& shortcut_data_path, | 247 void UpdatePlatformShortcuts(const base::FilePath& shortcut_data_path, |
248 const base::string16& old_app_title, | 248 const base::string16& old_app_title, |
249 std::unique_ptr<ShortcutInfo> shortcut_info); | 249 ShortcutInfo* shortcut_info); |
Matt Giuca
2017/03/01 08:49:55
Same.
tzik
2017/03/01 12:34:04
Done.
| |
250 | 250 |
251 // Delete all the shortcuts for an entire profile. | 251 // Delete all the shortcuts for an entire profile. |
252 // This is executed on the FILE thread. | 252 // This is executed on the FILE thread. |
253 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path); | 253 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path); |
254 | 254 |
255 // Sanitizes |name| and returns a version of it that is safe to use as an | 255 // Sanitizes |name| and returns a version of it that is safe to use as an |
256 // on-disk file name . | 256 // on-disk file name . |
257 base::FilePath GetSanitizedFileName(const base::string16& name); | 257 base::FilePath GetSanitizedFileName(const base::string16& name); |
258 | 258 |
259 // Clears |shortcut_info| and invokes |callback| unless it's null. | |
260 void DeleteShortcutInfoOnUIThread(std::unique_ptr<ShortcutInfo> shortcut_info, | |
261 const base::Closure& callback); | |
262 | |
259 } // namespace internals | 263 } // namespace internals |
260 | 264 |
261 } // namespace web_app | 265 } // namespace web_app |
262 | 266 |
263 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 267 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
OLD | NEW |