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_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ |
6 #define CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ | 6 #define CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | |
11 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 class WebContents; | 13 class WebContents; |
15 } | 14 } |
16 | 15 |
17 namespace extensions { | 16 namespace extensions { |
18 class Extension; | 17 class Extension; |
19 } | 18 } |
20 | 19 |
21 class Profile; | 20 class Profile; |
22 | 21 |
23 namespace web_app { | 22 namespace web_app { |
24 | 23 |
25 typedef base::Callback<void(const ShellIntegration::ShortcutInfo&)> | |
26 ShortcutInfoCallback; | |
27 | |
28 ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( | |
29 const extensions::Extension* extension, Profile* profile); | |
30 | |
31 // Extracts shortcut info of the given WebContents. | 24 // Extracts shortcut info of the given WebContents. |
32 void GetShortcutInfoForTab(content::WebContents* web_contents, | 25 void GetShortcutInfoForTab(content::WebContents* web_contents, |
33 ShellIntegration::ShortcutInfo* info); | 26 ShellIntegration::ShortcutInfo* info); |
34 | 27 |
35 // Updates web app shortcut of the WebContents. This function checks and | 28 // Updates web app shortcut of the WebContents. This function checks and |
36 // updates web app icon and shortcuts if needed. For icon, the check is based | 29 // updates web app icon and shortcuts if needed. For icon, the check is based |
37 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu | 30 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu |
38 // and quick launch (as well as pinned shortcut) for shortcut and only | 31 // and quick launch (as well as pinned shortcut) for shortcut and only |
39 // updates (recreates) them if they exits. | 32 // updates (recreates) them if they exits. |
40 void UpdateShortcutForTabContents(content::WebContents* web_contents); | 33 void UpdateShortcutForTabContents(content::WebContents* web_contents); |
41 | 34 |
42 // Updates the shortcut info for |extension| and |profile|. | |
43 void UpdateShortcutInfoForApp(const extensions::Extension& extension, | |
44 Profile* profile, | |
45 ShellIntegration::ShortcutInfo* shortcut_info); | |
46 | |
47 // Fetches the icon for |extension| and calls |callback| with shortcut info | |
48 // filled out as by UpdateShortcutInfoForApp. | |
49 void UpdateShortcutInfoAndIconForApp( | |
50 const extensions::Extension* extension, | |
51 Profile* profile, | |
52 const ShortcutInfoCallback& callback); | |
53 | |
54 } // namespace web_app | 35 } // namespace web_app |
55 | 36 |
56 #endif // CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ | 37 #endif // CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ |
OLD | NEW |