| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/shell_integration.h" | 14 #include "chrome/browser/shell_integration.h" |
| 15 #include "chrome/common/web_apps.h" | 15 #include "chrome/common/web_apps.h" |
| 16 | 16 |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 namespace web_app { | 19 namespace web_app { |
| 20 | 20 |
| 21 // Compute a deterministic name based on data in the shortcut_info. |
| 22 std::string GenerateApplicationNameFromInfo( |
| 23 const ShellIntegration::ShortcutInfo& shortcut_info); |
| 24 |
| 21 // Compute a deterministic name based on the URL. We use this pseudo name | 25 // Compute a deterministic name based on the URL. We use this pseudo name |
| 22 // as a key to store window location per application URLs in Browser and | 26 // as a key to store window location per application URLs in Browser and |
| 23 // as app id for BrowserWindow, shortcut and jump list. | 27 // as app id for BrowserWindow, shortcut and jump list. |
| 24 std::string GenerateApplicationNameFromURL(const GURL& url); | 28 std::string GenerateApplicationNameFromURL(const GURL& url); |
| 25 | 29 |
| 26 // Compute a deterministic name based on an extension/apps's id. | 30 // Compute a deterministic name based on an extension/apps's id. |
| 27 std::string GenerateApplicationNameFromExtensionId(const std::string& id); | 31 std::string GenerateApplicationNameFromExtensionId(const std::string& id); |
| 28 | 32 |
| 29 // Callback after user dismisses CreateShortcutView. "true" indicates | 33 // Callback after user dismisses CreateShortcutView. "true" indicates |
| 30 // shortcut is created successfully. Otherwise, it is false. | 34 // shortcut is created successfully. Otherwise, it is false. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 FilePath GetDataDir(const FilePath& profile_path); | 51 FilePath GetDataDir(const FilePath& profile_path); |
| 48 | 52 |
| 49 #if defined(TOOLKIT_VIEWS) | 53 #if defined(TOOLKIT_VIEWS) |
| 50 // Extracts icons info from web app data. Take only square shaped icons and | 54 // Extracts icons info from web app data. Take only square shaped icons and |
| 51 // sort them from smallest to largest. | 55 // sort them from smallest to largest. |
| 52 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; | 56 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; |
| 53 void GetIconsInfo(const WebApplicationInfo& app_info, | 57 void GetIconsInfo(const WebApplicationInfo& app_info, |
| 54 IconInfoList* icons); | 58 IconInfoList* icons); |
| 55 #endif | 59 #endif |
| 56 | 60 |
| 61 #if defined(TOOLKIT_GTK) |
| 62 // GTK+ windows that correspond to web apps need to have a deterministic (and |
| 63 // different) WMClass than normal chrome windows so the window manager groups |
| 64 // them as a separate application. |
| 65 std::string GetWMClassFromAppName(std::string app_name); |
| 66 #endif |
| 67 |
| 57 namespace internals { | 68 namespace internals { |
| 58 | 69 |
| 59 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
| 60 FilePath GetSanitizedFileName(const string16& name); | 71 FilePath GetSanitizedFileName(const string16& name); |
| 61 | 72 |
| 62 bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image); | 73 bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image); |
| 63 #endif | 74 #endif |
| 64 | 75 |
| 65 FilePath GetWebAppDataDirectory(const FilePath& root_dir, | 76 FilePath GetWebAppDataDirectory(const FilePath& root_dir, |
| 66 const ShellIntegration::ShortcutInfo& info); | 77 const ShellIntegration::ShortcutInfo& info); |
| 67 } // namespace internals | 78 } // namespace internals |
| 68 | 79 |
| 69 } // namespace web_app | 80 } // namespace web_app |
| 70 | 81 |
| 71 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 82 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
| OLD | NEW |