| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/shell_integration.h" | 15 #include "chrome/browser/shell_integration.h" |
| 16 #include "chrome/common/web_application_info.h" | 16 #include "chrome/common/web_application_info.h" |
| 17 | 17 |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace content { |
| 21 class WebContents; |
| 22 } |
| 23 |
| 20 namespace extensions { | 24 namespace extensions { |
| 21 class Extension; | 25 class Extension; |
| 22 } | 26 } |
| 23 | 27 |
| 24 namespace gfx { | 28 namespace gfx { |
| 25 class ImageFamily; | 29 class ImageFamily; |
| 26 } | 30 } |
| 27 | 31 |
| 28 namespace web_app { | 32 namespace web_app { |
| 29 | 33 |
| 30 // This encodes the cause of shortcut creation as the correct behavior in each | 34 // This encodes the cause of shortcut creation as the correct behavior in each |
| 31 // case is implementation specific. | 35 // case is implementation specific. |
| 32 enum ShortcutCreationReason { | 36 enum ShortcutCreationReason { |
| 33 SHORTCUT_CREATION_BY_USER, | 37 SHORTCUT_CREATION_BY_USER, |
| 34 SHORTCUT_CREATION_AUTOMATED, | 38 SHORTCUT_CREATION_AUTOMATED, |
| 35 }; | 39 }; |
| 36 | 40 |
| 37 typedef base::Callback<void(const ShellIntegration::ShortcutInfo&)> | 41 typedef base::Callback<void(const ShellIntegration::ShortcutInfo&)> |
| 38 ShortcutInfoCallback; | 42 ShortcutInfoCallback; |
| 39 | 43 |
| 44 // Extracts shortcut info of the given WebContents. |
| 45 void GetShortcutInfoForTab(content::WebContents* web_contents, |
| 46 ShellIntegration::ShortcutInfo* info); |
| 47 |
| 40 ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( | 48 ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( |
| 41 const extensions::Extension* app, | 49 const extensions::Extension* app, |
| 42 Profile* profile); | 50 Profile* profile); |
| 43 | 51 |
| 44 // Fetches the icon for |extension| and calls |callback| with shortcut info | 52 // Fetches the icon for |extension| and calls |callback| with shortcut info |
| 45 // filled out as by UpdateShortcutInfoForApp. | 53 // filled out as by UpdateShortcutInfoForApp. |
| 46 void UpdateShortcutInfoAndIconForApp( | 54 void UpdateShortcutInfoAndIconForApp( |
| 47 const extensions::Extension* extension, | 55 const extensions::Extension* extension, |
| 48 Profile* profile, | 56 Profile* profile, |
| 49 const ShortcutInfoCallback& callback); | 57 const ShortcutInfoCallback& callback); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 171 |
| 164 // Sanitizes |name| and returns a version of it that is safe to use as an | 172 // Sanitizes |name| and returns a version of it that is safe to use as an |
| 165 // on-disk file name . | 173 // on-disk file name . |
| 166 base::FilePath GetSanitizedFileName(const base::string16& name); | 174 base::FilePath GetSanitizedFileName(const base::string16& name); |
| 167 | 175 |
| 168 } // namespace internals | 176 } // namespace internals |
| 169 | 177 |
| 170 } // namespace web_app | 178 } // namespace web_app |
| 171 | 179 |
| 172 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 180 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
| OLD | NEW |