| 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 e03846c1912d59914a7e537cc3114b6966890cc1..7c42ca1f9229c790b0e9197485a46d5cbaf9cd82 100644
|
| --- a/chrome/browser/web_applications/web_app.h
|
| +++ b/chrome/browser/web_applications/web_app.h
|
| @@ -30,8 +30,68 @@ namespace gfx {
|
| class ImageFamily;
|
| }
|
|
|
| +// This namespace contains everything related to integrating Chrome apps into
|
| +// the OS. E.g. creating and updating shorcuts for apps, setting up file
|
| +// associations, etc.
|
| namespace web_app {
|
|
|
| +// Represents the info required to create a shortcut for an app.
|
| +struct ShortcutInfo {
|
| + 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 {
|
| @@ -39,12 +99,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
|
| @@ -53,7 +113,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);
|
|
|
| @@ -78,7 +138,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
|
| @@ -96,13 +156,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);
|
|
|
| @@ -141,7 +201,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
|
| @@ -150,8 +210,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.
|
| @@ -161,9 +221,9 @@ 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 web_app::ShortcutInfo& shortcut_info,
|
| const extensions::FileHandlersInfo& file_handlers_info,
|
| - const ShellIntegration::ShortcutLocations& creation_locations,
|
| + const web_app::ShortcutLocations& creation_locations,
|
| ShortcutCreationReason creation_reason);
|
|
|
| // Delete all the shortcuts we have added for this extension. This is the
|
| @@ -171,7 +231,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
|
| @@ -179,7 +239,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,
|
| const extensions::FileHandlersInfo& file_handlers_info);
|
|
|
| // Delete all the shortcuts for an entire profile.
|
|
|