| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> |
| 9 |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/file_path.h" | 11 #include "build/build_config.h" |
| 10 #include "chrome/browser/shell_integration.h" | 12 #include "chrome/browser/shell_integration.h" |
| 11 #include "webkit/glue/dom_operations.h" | 13 #include "webkit/glue/dom_operations.h" |
| 12 | 14 |
| 15 class FilePath; |
| 13 class Profile; | 16 class Profile; |
| 14 class TabContents; | 17 class TabContents; |
| 15 | 18 |
| 16 namespace web_app { | 19 namespace web_app { |
| 17 | 20 |
| 18 // Compute a deterministic name based on the URL. We use this pseudo name | 21 // Compute a deterministic name based on the URL. We use this pseudo name |
| 19 // as a key to store window location per application URLs in Browser and | 22 // as a key to store window location per application URLs in Browser and |
| 20 // as app id for BrowserWindow, shortcut and jump list. | 23 // as app id for BrowserWindow, shortcut and jump list. |
| 21 std::wstring GenerateApplicationNameFromURL(const GURL& url); | 24 std::wstring GenerateApplicationNameFromURL(const GURL& url); |
| 22 | 25 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 const FilePath& profile_path, | 36 const FilePath& profile_path, |
| 34 const ShellIntegration::ShortcutInfo& shortcut_info, | 37 const ShellIntegration::ShortcutInfo& shortcut_info, |
| 35 CreateShortcutCallback* callback); | 38 CreateShortcutCallback* callback); |
| 36 | 39 |
| 37 // Returns true if given url is a valid web app url. | 40 // Returns true if given url is a valid web app url. |
| 38 bool IsValidUrl(const GURL& url); | 41 bool IsValidUrl(const GURL& url); |
| 39 | 42 |
| 40 // Returns data dir for web apps for given profile path. | 43 // Returns data dir for web apps for given profile path. |
| 41 FilePath GetDataDir(const FilePath& profile_path); | 44 FilePath GetDataDir(const FilePath& profile_path); |
| 42 | 45 |
| 46 #if defined(TOOLKIT_VIEWS) |
| 43 // Extracts icons info from web app data. Take only square shaped icons and | 47 // Extracts icons info from web app data. Take only square shaped icons and |
| 44 // sort them from smallest to largest. | 48 // sort them from smallest to largest. |
| 45 typedef std::vector<webkit_glue::WebApplicationInfo::IconInfo> IconInfoList; | 49 typedef std::vector<webkit_glue::WebApplicationInfo::IconInfo> IconInfoList; |
| 46 void GetIconsInfo(const webkit_glue::WebApplicationInfo& app_info, | 50 void GetIconsInfo(const webkit_glue::WebApplicationInfo& app_info, |
| 47 IconInfoList* icons); | 51 IconInfoList* icons); |
| 52 #endif |
| 48 | 53 |
| 49 // Extracts shortcut info of given TabContents. | 54 // Extracts shortcut info of given TabContents. |
| 50 void GetShortcutInfoForTab(TabContents* tab_contents, | 55 void GetShortcutInfoForTab(TabContents* tab_contents, |
| 51 ShellIntegration::ShortcutInfo* info); | 56 ShellIntegration::ShortcutInfo* info); |
| 52 | 57 |
| 53 // Updates web app shortcut of the TabContents. This function checks and | 58 // Updates web app shortcut of the TabContents. This function checks and |
| 54 // updates web app icon and shortcuts if needed. For icon, the check is based | 59 // updates web app icon and shortcuts if needed. For icon, the check is based |
| 55 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu | 60 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu |
| 56 // and quick launch (as well as pinned shortcut) for shortcut and only | 61 // and quick launch (as well as pinned shortcut) for shortcut and only |
| 57 // updates (recreates) them if they exits. | 62 // updates (recreates) them if they exits. |
| 58 void UpdateShortcutForTabContents(TabContents* tab_contents); | 63 void UpdateShortcutForTabContents(TabContents* tab_contents); |
| 59 | 64 |
| 60 }; // namespace web_app | 65 }; // namespace web_app |
| 61 | 66 |
| 62 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 67 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
| OLD | NEW |