Chromium Code Reviews| Index: chrome/browser/web_applications/web_app.h |
| diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h |
| index 468bdbae4e8ca3a64409af5ba870c9fba1419036..45cacbd563e0c02db92a465f744e4dbdb4d80b2c 100644 |
| --- a/chrome/browser/web_applications/web_app.h |
| +++ b/chrome/browser/web_applications/web_app.h |
| @@ -31,6 +31,62 @@ class ImageFamily; |
| namespace web_app { |
|
calamity
2014/04/14 04:23:01
It would be good to have a comment summarizing wha
jackhou1
2014/04/14 05:49:19
Done.
|
| +struct ShortcutInfo { |
|
calamity
2014/04/14 04:23:01
Comment for this struct, noting that it represents
jackhou1
2014/04/14 05:49:19
Done.
|
| + ShortcutInfo(); |
| + ~ShortcutInfo(); |
| + |
| + GURL url; |
| + // If |extension_id| is non-empty, this is short cut is to an extension-app |
| + // and the launch url will be detected at start-up. In this case, |url| |
| + // is still used to generate the app id (windows app id, not chrome app id). |
| + std::string extension_id; |
| + bool is_platform_app; |
| + base::string16 title; |
| + base::string16 description; |
| + base::FilePath extension_path; |
| + gfx::ImageFamily favicon; |
| + base::FilePath profile_path; |
| + std::string profile_name; |
| +}; |
| + |
| +// This specifies a folder in the system applications menu (e.g the Start Menu |
| +// on Windows). |
| +// |
| +// These represent the applications menu root, the "Google Chrome" folder and |
| +// the "Chrome Apps" folder respectively. |
| +// |
| +// NB: On Linux, these locations may not be used by the window manager (e.g |
| +// Unity and Gnome Shell). |
| +enum ApplicationsMenuLocation { |
| + APP_MENU_LOCATION_NONE, |
| + APP_MENU_LOCATION_ROOT, |
| + APP_MENU_LOCATION_SUBDIR_CHROME, |
| + APP_MENU_LOCATION_SUBDIR_CHROMEAPPS, |
| +}; |
| + |
| +// Info about which locations to create app shortcuts in. |
| +struct ShortcutLocations { |
| + ShortcutLocations(); |
| + |
| + bool on_desktop; |
| + |
| + ApplicationsMenuLocation applications_menu_location; |
| + |
| + // For Windows, this refers to quick launch bar prior to Win7. In Win7, |
| + // this means "pin to taskbar". For Mac/Linux, this could be used for |
| + // Mac dock or the gnome/kde application launcher. However, those are not |
| + // implemented yet. |
| + bool in_quick_launch_bar; |
| + |
| +#if defined(OS_POSIX) |
| + // For Linux, this refers to a shortcut which the system knows about (for |
| + // the purpose of identifying windows and giving them the correct |
| + // title/icon), but which does not show up in menus or search results. |
| + // Ignored if applications_menu_location is not APP_MENU_LOCATION_NONE. |
| + bool hidden; |
| +#endif |
| +}; |
| + |
| // This encodes the cause of shortcut creation as the correct behavior in each |
| // case is implementation specific. |
| enum ShortcutCreationReason { |
| @@ -38,12 +94,12 @@ enum ShortcutCreationReason { |
| SHORTCUT_CREATION_AUTOMATED, |
| }; |
| -typedef base::Callback<void(const ShellIntegration::ShortcutInfo&)> |
| +typedef base::Callback<void(const web_app::ShortcutInfo&)> |
| ShortcutInfoCallback; |
| // Extracts shortcut info of the given WebContents. |
| void GetShortcutInfoForTab(content::WebContents* web_contents, |
| - ShellIntegration::ShortcutInfo* info); |
| + web_app::ShortcutInfo* info); |
| // Updates web app shortcut of the WebContents. This function checks and |
| // updates web app icon and shortcuts if needed. For icon, the check is based |
| @@ -52,7 +108,7 @@ void GetShortcutInfoForTab(content::WebContents* web_contents, |
| // updates (recreates) them if they exits. |
| void UpdateShortcutForTabContents(content::WebContents* web_contents); |
| -ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( |
| +web_app::ShortcutInfo ShortcutInfoForExtensionAndProfile( |
| const extensions::Extension* app, |
| Profile* profile); |
| @@ -77,7 +133,7 @@ base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
| // Compute a deterministic name based on data in the shortcut_info. |
| std::string GenerateApplicationNameFromInfo( |
| - const ShellIntegration::ShortcutInfo& shortcut_info); |
| + const web_app::ShortcutInfo& shortcut_info); |
| // Compute a deterministic name based on the URL. We use this pseudo name |
| // as a key to store window location per application URLs in Browser and |
| @@ -95,13 +151,13 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name); |
| // |creation_locations| contains information about where to create them. |
| void CreateShortcutsForShortcutInfo( |
| web_app::ShortcutCreationReason reason, |
| - const ShellIntegration::ShortcutLocations& locations, |
| - const ShellIntegration::ShortcutInfo& shortcut_info); |
| + const web_app::ShortcutLocations& locations, |
| + const web_app::ShortcutInfo& shortcut_info); |
| // Creates shortcuts for an app. |
| void CreateShortcuts( |
| ShortcutCreationReason reason, |
| - const ShellIntegration::ShortcutLocations& locations, |
| + const web_app::ShortcutLocations& locations, |
| Profile* profile, |
| const extensions::Extension* app); |
| @@ -140,7 +196,7 @@ namespace internals { |
| // Returns the Windows user-level shortcut paths that are specified in |
| // |creation_locations|. |
| std::vector<base::FilePath> GetShortcutPaths( |
| - const ShellIntegration::ShortcutLocations& creation_locations); |
| + const web_app::ShortcutLocations& creation_locations); |
| #endif |
| // Creates a shortcut. Must be called on the file thread. This is used to |
| @@ -149,8 +205,8 @@ std::vector<base::FilePath> GetShortcutPaths( |
| // |creation_locations| contains information about where to create them. |
| bool CreateShortcutsOnFileThread( |
| ShortcutCreationReason reason, |
| - const ShellIntegration::ShortcutLocations& locations, |
| - const ShellIntegration::ShortcutInfo& shortcut_info); |
| + const web_app::ShortcutLocations& locations, |
| + const web_app::ShortcutInfo& shortcut_info); |
| // Implemented for each platform, does the platform specific parts of creating |
| // shortcuts. Used internally by CreateShortcutsOnFileThread. |
| @@ -160,8 +216,8 @@ bool CreateShortcutsOnFileThread( |
| // |creation_locations| contains information about where to create them. |
| bool CreatePlatformShortcuts( |
| const base::FilePath& shortcut_data_path, |
| - const ShellIntegration::ShortcutInfo& shortcut_info, |
| - const ShellIntegration::ShortcutLocations& creation_locations, |
| + const web_app::ShortcutInfo& shortcut_info, |
| + const web_app::ShortcutLocations& creation_locations, |
| ShortcutCreationReason creation_reason); |
| // Delete all the shortcuts we have added for this extension. This is the |
| @@ -169,7 +225,7 @@ bool CreatePlatformShortcuts( |
| // is executed on the FILE thread. |
| void DeletePlatformShortcuts( |
| const base::FilePath& shortcut_data_path, |
| - const ShellIntegration::ShortcutInfo& shortcut_info); |
| + const web_app::ShortcutInfo& shortcut_info); |
| // Updates all the shortcuts we have added for this extension. This is the |
| // platform specific implementation of the UpdateAllShortcuts function, and |
| @@ -177,7 +233,7 @@ void DeletePlatformShortcuts( |
| void UpdatePlatformShortcuts( |
| const base::FilePath& shortcut_data_path, |
| const base::string16& old_app_title, |
| - const ShellIntegration::ShortcutInfo& shortcut_info); |
| + const web_app::ShortcutInfo& shortcut_info); |
| // Delete all the shortcuts for an entire profile. |
| // This is executed on the FILE thread. |