summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-15 13:02:15 +0000
committerjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-15 13:02:15 +0000
commit2e0424a79f710306886b1c58075b86feff3798a1 (patch)
treebe9ea19f03537b2ec275bbcfdcf032e566829e01
parent0cc8aa4c3854b322602a7960f1a0ee1a7c5c26e5 (diff)
downloadchromium_src-2e0424a79f710306886b1c58075b86feff3798a1.zip
chromium_src-2e0424a79f710306886b1c58075b86feff3798a1.tar.gz
chromium_src-2e0424a79f710306886b1c58075b86feff3798a1.tar.bz2
Move ShortcutInfo, ShortcutLocations from ShellIntegration to web_app.
BUG=356889 Review URL: https://codereview.chromium.org/231673005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263826 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/apps/shortcut_manager.cc4
-rw-r--r--chrome/browser/shell_integration.cc16
-rw-r--r--chrome/browser/shell_integration.h56
-rw-r--r--chrome/browser/shell_integration_linux.cc26
-rw-r--r--chrome/browser/shell_integration_linux.h10
-rw-r--r--chrome/browser/shell_integration_linux_unittest.cc21
-rw-r--r--chrome/browser/ui/app_list/app_list_service_mac.mm8
-rw-r--r--chrome/browser/ui/app_list/app_list_view_delegate.cc2
-rw-r--r--chrome/browser/ui/views/app_list/win/app_list_service_win.cc6
-rw-r--r--chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc4
-rw-r--r--chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h7
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.cc8
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.h4
-rw-r--r--chrome/browser/web_applications/update_shortcut_worker_win.h2
-rw-r--r--chrome/browser/web_applications/web_app.cc56
-rw-r--r--chrome/browser/web_applications/web_app.h88
-rw-r--r--chrome/browser/web_applications/web_app_android.cc8
-rw-r--r--chrome/browser/web_applications/web_app_chromeos.cc8
-rw-r--r--chrome/browser/web_applications/web_app_linux.cc10
-rw-r--r--chrome/browser/web_applications/web_app_mac.h11
-rw-r--r--chrome/browser/web_applications/web_app_mac.mm27
-rw-r--r--chrome/browser/web_applications/web_app_mac_unittest.mm20
-rw-r--r--chrome/browser/web_applications/web_app_unittest.cc2
-rw-r--r--chrome/browser/web_applications/web_app_win.cc25
-rw-r--r--chrome/browser/web_applications/web_app_win.h4
25 files changed, 219 insertions, 214 deletions
diff --git a/chrome/browser/apps/shortcut_manager.cc b/chrome/browser/apps/shortcut_manager.cc
index 5c6ce69d..326722c 100644
--- a/chrome/browser/apps/shortcut_manager.cc
+++ b/chrome/browser/apps/shortcut_manager.cc
@@ -39,10 +39,10 @@ namespace {
// not already one present.
void CreateShortcutsInApplicationsMenu(Profile* profile,
const Extension* app) {
- ShellIntegration::ShortcutLocations creation_locations;
+ web_app::ShortcutLocations creation_locations;
// Create the shortcut in the Chrome Apps subdir.
creation_locations.applications_menu_location =
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
web_app::CreateShortcuts(
web_app::SHORTCUT_CREATION_AUTOMATED, creation_locations, profile, app);
}
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index cb6b728..81415f7 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -37,22 +37,6 @@ ShellIntegration::DefaultWebClientSetPermission
return CanSetAsDefaultBrowser();
}
-ShellIntegration::ShortcutInfo::ShortcutInfo()
- : is_platform_app(false) {
-}
-
-ShellIntegration::ShortcutInfo::~ShortcutInfo() {}
-
-ShellIntegration::ShortcutLocations::ShortcutLocations()
- : on_desktop(false),
- applications_menu_location(APP_MENU_LOCATION_NONE),
- in_quick_launch_bar(false)
-#if defined(OS_POSIX)
- , hidden(false)
-#endif
- {
-}
-
static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL;
// static
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h
index 27cdc7c..6844451 100644
--- a/chrome/browser/shell_integration.h
+++ b/chrome/browser/shell_integration.h
@@ -92,62 +92,6 @@ class ShellIntegration {
static DefaultWebClientState
IsDefaultProtocolClient(const std::string& protocol);
- 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
- };
-
// Data that needs to be passed between the app launcher stub and Chrome.
struct AppModeInfo {
};
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 771a183..9de486c 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -36,7 +36,7 @@
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
-#include "chrome/browser/web_applications/web_app.h"
+#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
@@ -616,7 +616,7 @@ std::string GetIconName() {
#endif
}
-ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
+web_app::ShortcutLocations GetExistingShortcutLocations(
base::Environment* env,
const base::FilePath& profile_path,
const std::string& extension_id) {
@@ -627,7 +627,7 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
desktop_path);
}
-ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
+web_app::ShortcutLocations GetExistingShortcutLocations(
base::Environment* env,
const base::FilePath& profile_path,
const std::string& extension_id,
@@ -637,7 +637,7 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
base::FilePath shortcut_filename = GetExtensionShortcutFilename(
profile_path, extension_id);
DCHECK(!shortcut_filename.empty());
- ShellIntegration::ShortcutLocations locations;
+ web_app::ShortcutLocations locations;
// Determine whether there is a shortcut on desktop.
if (!desktop_path.empty()) {
@@ -655,7 +655,7 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
locations.hidden = true;
} else {
locations.applications_menu_location =
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
}
}
@@ -870,8 +870,8 @@ std::string GetDirectoryFileContents(const base::string16& title,
}
bool CreateDesktopShortcut(
- const ShellIntegration::ShortcutInfo& shortcut_info,
- const ShellIntegration::ShortcutLocations& creation_locations) {
+ const web_app::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutLocations& creation_locations) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::FilePath shortcut_filename;
@@ -885,7 +885,7 @@ bool CreateDesktopShortcut(
// The 'applications_menu_location' and 'hidden' locations are actually the
// same place ('applications').
if (creation_locations.applications_menu_location !=
- ShellIntegration::APP_MENU_LOCATION_NONE ||
+ web_app::APP_MENU_LOCATION_NONE ||
creation_locations.hidden)
DeleteShortcutInApplicationsMenu(shortcut_filename, base::FilePath());
} else {
@@ -922,15 +922,15 @@ bool CreateDesktopShortcut(
}
if (creation_locations.applications_menu_location !=
- ShellIntegration::APP_MENU_LOCATION_NONE ||
+ web_app::APP_MENU_LOCATION_NONE ||
creation_locations.hidden) {
base::FilePath directory_filename;
std::string directory_contents;
switch (creation_locations.applications_menu_location) {
- case ShellIntegration::APP_MENU_LOCATION_NONE:
- case ShellIntegration::APP_MENU_LOCATION_ROOT:
+ case web_app::APP_MENU_LOCATION_NONE:
+ case web_app::APP_MENU_LOCATION_ROOT:
break;
- case ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS:
+ case web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS:
directory_filename = base::FilePath(kDirectoryFilename);
directory_contents = ShellIntegrationLinux::GetDirectoryFileContents(
ShellIntegration::GetAppShortcutsSubdirName(), "");
@@ -950,7 +950,7 @@ bool CreateDesktopShortcut(
icon_name,
shortcut_info.profile_path,
creation_locations.applications_menu_location ==
- ShellIntegration::APP_MENU_LOCATION_NONE);
+ web_app::APP_MENU_LOCATION_NONE);
success = CreateShortcutInApplicationsMenu(
shortcut_filename, contents, directory_filename, directory_contents) &&
success;
diff --git a/chrome/browser/shell_integration_linux.h b/chrome/browser/shell_integration_linux.h
index 44f0b7c..d7e5c77 100644
--- a/chrome/browser/shell_integration_linux.h
+++ b/chrome/browser/shell_integration_linux.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
-#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/web_applications/web_app.h"
#include "url/gurl.h"
namespace base {
@@ -48,7 +48,7 @@ std::string GetIconName();
// This searches the file system for .desktop files in appropriate locations. A
// shortcut with NoDisplay=true causes hidden to become true, instead of
// creating at APP_MENU_LOCATIONS_SUBDIR_CHROMEAPPS.
-ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
+web_app::ShortcutLocations GetExistingShortcutLocations(
base::Environment* env,
const base::FilePath& profile_path,
const std::string& extension_id);
@@ -56,7 +56,7 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
// Version of GetExistingShortcutLocations which takes an explicit path
// to the user's desktop directory. Useful for testing.
// If |desktop_path| is empty, the desktop is not searched.
-ShellIntegration::ShortcutLocations GetExistingShortcutLocations(
+web_app::ShortcutLocations GetExistingShortcutLocations(
base::Environment* env,
const base::FilePath& profile_path,
const std::string& extension_id,
@@ -116,8 +116,8 @@ std::string GetDirectoryFileContents(const base::string16& title,
// For extensions, duplicate shortcuts are avoided, so if a requested shortcut
// already exists it is deleted first.
bool CreateDesktopShortcut(
- const ShellIntegration::ShortcutInfo& shortcut_info,
- const ShellIntegration::ShortcutLocations& creation_locations);
+ const web_app::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutLocations& creation_locations);
// Create shortcuts in the application menu for the app launcher. Duplicate
// shortcuts are avoided, so if a requested shortcut already exists it is
diff --git a/chrome/browser/shell_integration_linux_unittest.cc b/chrome/browser/shell_integration_linux_unittest.cc
index adf4378..d1f1816 100644
--- a/chrome/browser/shell_integration_linux_unittest.cc
+++ b/chrome/browser/shell_integration_linux_unittest.cc
@@ -19,7 +19,6 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_path_override.h"
-#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/test/test_browser_thread.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -167,11 +166,11 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
// No existing shortcuts.
{
MockEnvironment env;
- ShellIntegration::ShortcutLocations result =
+ web_app::ShortcutLocations result =
ShellIntegrationLinux::GetExistingShortcutLocations(
&env, kProfilePath, kExtensionId);
EXPECT_FALSE(result.on_desktop);
- EXPECT_EQ(ShellIntegration::APP_MENU_LOCATION_NONE,
+ EXPECT_EQ(web_app::APP_MENU_LOCATION_NONE,
result.applications_menu_location);
EXPECT_FALSE(result.in_quick_launch_bar);
@@ -189,11 +188,11 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
ASSERT_FALSE(base::WriteFile(
desktop_path.AppendASCII(kTemplateFilename),
"", 0));
- ShellIntegration::ShortcutLocations result =
+ web_app::ShortcutLocations result =
ShellIntegrationLinux::GetExistingShortcutLocations(
&env, kProfilePath, kExtensionId, desktop_path);
EXPECT_TRUE(result.on_desktop);
- EXPECT_EQ(ShellIntegration::APP_MENU_LOCATION_NONE,
+ EXPECT_EQ(web_app::APP_MENU_LOCATION_NONE,
result.applications_menu_location);
EXPECT_FALSE(result.in_quick_launch_bar);
@@ -212,11 +211,11 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
ASSERT_FALSE(base::WriteFile(
apps_path.AppendASCII(kTemplateFilename),
"", 0));
- ShellIntegration::ShortcutLocations result =
+ web_app::ShortcutLocations result =
ShellIntegrationLinux::GetExistingShortcutLocations(
&env, kProfilePath, kExtensionId);
EXPECT_FALSE(result.on_desktop);
- EXPECT_EQ(ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS,
+ EXPECT_EQ(web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS,
result.applications_menu_location);
EXPECT_FALSE(result.in_quick_launch_bar);
@@ -235,12 +234,12 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
ASSERT_TRUE(base::WriteFile(
apps_path.AppendASCII(kTemplateFilename),
kNoDisplayDesktopFile, strlen(kNoDisplayDesktopFile)));
- ShellIntegration::ShortcutLocations result =
+ web_app::ShortcutLocations result =
ShellIntegrationLinux::GetExistingShortcutLocations(
&env, kProfilePath, kExtensionId);
// Doesn't count as being in applications menu.
EXPECT_FALSE(result.on_desktop);
- EXPECT_EQ(ShellIntegration::APP_MENU_LOCATION_NONE,
+ EXPECT_EQ(web_app::APP_MENU_LOCATION_NONE,
result.applications_menu_location);
EXPECT_FALSE(result.in_quick_launch_bar);
EXPECT_TRUE(result.hidden);
@@ -266,11 +265,11 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
ASSERT_FALSE(base::WriteFile(
apps_path.AppendASCII(kTemplateFilename),
"", 0));
- ShellIntegration::ShortcutLocations result =
+ web_app::ShortcutLocations result =
ShellIntegrationLinux::GetExistingShortcutLocations(
&env, kProfilePath, kExtensionId, desktop_path);
EXPECT_TRUE(result.on_desktop);
- EXPECT_EQ(ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS,
+ EXPECT_EQ(web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS,
result.applications_menu_location);
EXPECT_FALSE(result.in_quick_launch_bar);
EXPECT_FALSE(result.hidden);
diff --git a/chrome/browser/ui/app_list/app_list_service_mac.mm b/chrome/browser/ui/app_list/app_list_service_mac.mm
index 242ace0..ec46383 100644
--- a/chrome/browser/ui/app_list/app_list_service_mac.mm
+++ b/chrome/browser/ui/app_list/app_list_service_mac.mm
@@ -87,9 +87,9 @@ const NSTimeInterval kAnimationDuration = 0.2;
// Distance towards the screen edge that the app list moves from when showing.
const CGFloat kDistanceMovedOnShow = 20;
-ShellIntegration::ShortcutInfo GetAppListShortcutInfo(
+web_app::ShortcutInfo GetAppListShortcutInfo(
const base::FilePath& profile_path) {
- ShellIntegration::ShortcutInfo shortcut_info;
+ web_app::ShortcutInfo shortcut_info;
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
if (channel == chrome::VersionInfo::CHANNEL_CANARY) {
shortcut_info.title =
@@ -108,7 +108,7 @@ ShellIntegration::ShortcutInfo GetAppListShortcutInfo(
void CreateAppListShim(const base::FilePath& profile_path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
WebApplicationInfo web_app_info;
- ShellIntegration::ShortcutInfo shortcut_info =
+ web_app::ShortcutInfo shortcut_info =
GetAppListShortcutInfo(profile_path);
ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance();
@@ -137,7 +137,7 @@ void CreateAppListShim(const base::FilePath& profile_path) {
*resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_256));
}
- ShellIntegration::ShortcutLocations shortcut_locations;
+ web_app::ShortcutLocations shortcut_locations;
PrefService* local_state = g_browser_process->local_state();
int installed_version =
local_state->GetInteger(prefs::kAppLauncherShortcutVersion);
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index 3b116f3..e9c2a50 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -55,7 +55,7 @@ const int kAutoLaunchDefaultTimeoutMilliSec = 50;
void CreateShortcutInWebAppDir(
const base::FilePath& app_data_dir,
base::Callback<void(const base::FilePath&)> callback,
- const ShellIntegration::ShortcutInfo& info) {
+ const web_app::ShortcutInfo& info) {
content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,
FROM_HERE,
diff --git a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
index aa8be82..33ed4745 100644
--- a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
+++ b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
@@ -203,7 +203,7 @@ void SetDidRunForNDayActiveStats() {
void CreateAppListShortcuts(
const base::FilePath& user_data_dir,
const base::string16& app_model_id,
- const ShellIntegration::ShortcutLocations& creation_locations) {
+ const web_app::ShortcutLocations& creation_locations) {
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
// Shortcut paths under which to create shortcuts.
@@ -455,11 +455,11 @@ void AppListServiceWin::CreateShortcut() {
// Shortcuts should only be created once. If the user unpins the taskbar
// shortcut, they can restore it by pinning the start menu or desktop
// shortcut.
- ShellIntegration::ShortcutLocations shortcut_locations;
+ web_app::ShortcutLocations shortcut_locations;
shortcut_locations.on_desktop = true;
shortcut_locations.in_quick_launch_bar = true;
shortcut_locations.applications_menu_location =
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROME;
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROME;
base::FilePath user_data_dir(
g_browser_process->profile_manager()->user_data_dir());
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
index 2c7ef56..94cddd4 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
@@ -36,7 +36,7 @@ namespace {
void CreateIconAndSetRelaunchDetails(
const base::FilePath& web_app_path,
const base::FilePath& icon_file,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const HWND hwnd) {
DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
@@ -88,7 +88,7 @@ void ChromeNativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
}
void ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
HWND hwnd = GetNativeAppWindowHWND();
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h
index d665eda..d29beb9 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h
@@ -5,9 +5,12 @@
#ifndef CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_WIN_H_
#define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_WIN_H_
-#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
+namespace web_app {
+struct ShortcutInfo;
+}
+
// Windows-specific parts of the views-backed native shell window implementation
// for packaged apps.
class ChromeNativeAppWindowViewsWin : public ChromeNativeAppWindowViews {
@@ -18,7 +21,7 @@ class ChromeNativeAppWindowViewsWin : public ChromeNativeAppWindowViews {
void ActivateParentDesktopIfNecessary();
void OnShortcutInfoLoaded(
- const ShellIntegration::ShortcutInfo& shortcut_info);
+ const web_app::ShortcutInfo& shortcut_info);
HWND GetNativeAppWindowHWND() const;
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index 054265e..521ebe3 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -371,13 +371,13 @@ bool CreateApplicationShortcutView::Accept() {
if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK))
return false;
- ShellIntegration::ShortcutLocations creation_locations;
+ web_app::ShortcutLocations creation_locations;
creation_locations.on_desktop = desktop_check_box_->checked();
if (menu_check_box_ != NULL && menu_check_box_->checked()) {
creation_locations.applications_menu_location =
create_in_chrome_apps_subdir_ ?
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS :
- ShellIntegration::APP_MENU_LOCATION_ROOT;
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS :
+ web_app::APP_MENU_LOCATION_ROOT;
}
#if defined(OS_WIN)
@@ -556,7 +556,7 @@ bool CreateChromeApplicationShortcutView::Cancel() {
// Called when the app's ShortcutInfo (with icon) is loaded.
void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
shortcut_info_ = shortcut_info;
CHECK(app_info_);
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h
index 602e843..86763a8 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.h
+++ b/chrome/browser/ui/views/create_application_shortcut_view.h
@@ -76,7 +76,7 @@ class CreateApplicationShortcutView : public views::DialogDelegateView,
views::Checkbox* quick_launch_check_box_;
// Target shortcut info.
- ShellIntegration::ShortcutInfo shortcut_info_;
+ web_app::ShortcutInfo shortcut_info_;
// If false, the shortcut will be created in the root level of the Start Menu.
bool create_in_chrome_apps_subdir_;
@@ -133,7 +133,7 @@ class CreateChromeApplicationShortcutView
private:
void OnShortcutInfoLoaded(
- const ShellIntegration::ShortcutInfo& shortcut_info);
+ const web_app::ShortcutInfo& shortcut_info);
const extensions::Extension* app_;
base::Closure close_callback_;
diff --git a/chrome/browser/web_applications/update_shortcut_worker_win.h b/chrome/browser/web_applications/update_shortcut_worker_win.h
index fcfa000..1169ee3 100644
--- a/chrome/browser/web_applications/update_shortcut_worker_win.h
+++ b/chrome/browser/web_applications/update_shortcut_worker_win.h
@@ -70,7 +70,7 @@ class UpdateShortcutWorker : public content::NotificationObserver {
web_app::IconInfoList unprocessed_icons_;
// Cached shortcut data from the web_contents_.
- ShellIntegration::ShortcutInfo shortcut_info_;
+ web_app::ShortcutInfo shortcut_info_;
// Our copy of profile path.
base::FilePath profile_path_;
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 8230eba..135b6f4 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -42,7 +42,7 @@ using content::BrowserThread;
namespace {
-typedef base::Callback<void(const ShellIntegration::ShortcutInfo&,
+typedef base::Callback<void(const web_app::ShortcutInfo&,
const extensions::FileHandlersInfo&)> InfoCallback;
#if defined(OS_MACOSX)
@@ -71,8 +71,8 @@ bool IconPrecedes(const WebApplicationInfo::IconInfo& left,
bool CreateShortcutsWithInfoOnFileThread(
web_app::ShortcutCreationReason reason,
- const ShellIntegration::ShortcutLocations& locations,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutLocations& locations,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
@@ -85,7 +85,7 @@ bool CreateShortcutsWithInfoOnFileThread(
}
void DeleteShortcutsOnFileThread(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory(
@@ -96,7 +96,7 @@ void DeleteShortcutsOnFileThread(
void UpdateShortcutsOnFileThread(
const base::string16& old_app_title,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
@@ -108,8 +108,8 @@ void UpdateShortcutsOnFileThread(
void CreateShortcutsWithInfo(
web_app::ShortcutCreationReason reason,
- const ShellIntegration::ShortcutLocations& locations,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutLocations& locations,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -123,7 +123,7 @@ void CreateShortcutsWithInfo(
void UpdateAllShortcutsForShortcutInfo(
const base::string16& old_app_title,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
BrowserThread::PostTask(
BrowserThread::FILE,
@@ -132,7 +132,7 @@ void UpdateAllShortcutsForShortcutInfo(
old_app_title, shortcut_info, file_handlers_info));
}
-void OnImageLoaded(ShellIntegration::ShortcutInfo shortcut_info,
+void OnImageLoaded(web_app::ShortcutInfo shortcut_info,
extensions::FileHandlersInfo file_handlers_info,
InfoCallback callback,
const gfx::ImageFamily& image_family) {
@@ -160,7 +160,7 @@ void OnImageLoaded(ShellIntegration::ShortcutInfo shortcut_info,
void GetInfoForApp(const extensions::Extension* extension,
Profile* profile,
const InfoCallback& callback) {
- ShellIntegration::ShortcutInfo shortcut_info =
+ web_app::ShortcutInfo shortcut_info =
web_app::ShortcutInfoForExtensionAndProfile(extension, profile);
extensions::FileHandlersInfo file_handlers_info(
extensions::FileHandlers::GetFileHandlers(extension));
@@ -212,7 +212,7 @@ void GetInfoForApp(const extensions::Extension* extension,
void IgnoreFileHandlersInfo(
const web_app::ShortcutInfoCallback& shortcut_info_callback,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
shortcut_info_callback.Run(shortcut_info);
}
@@ -243,8 +243,8 @@ base::FilePath GetSanitizedFileName(const base::string16& name) {
bool CreateShortcutsOnFileThread(
ShortcutCreationReason reason,
- const ShellIntegration::ShortcutLocations& locations,
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutLocations& locations,
+ const web_app::ShortcutInfo& shortcut_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
return CreateShortcutsWithInfoOnFileThread(
@@ -253,8 +253,24 @@ bool CreateShortcutsOnFileThread(
} // namespace internals
+web_app::ShortcutInfo::ShortcutInfo()
+ : is_platform_app(false) {
+}
+
+web_app::ShortcutInfo::~ShortcutInfo() {}
+
+web_app::ShortcutLocations::ShortcutLocations()
+ : on_desktop(false),
+ applications_menu_location(APP_MENU_LOCATION_NONE),
+ in_quick_launch_bar(false)
+#if defined(OS_POSIX)
+ , hidden(false)
+#endif
+ {
+}
+
void GetShortcutInfoForTab(content::WebContents* web_contents,
- ShellIntegration::ShortcutInfo* info) {
+ web_app::ShortcutInfo* info) {
DCHECK(info); // Must provide a valid info.
const FaviconTabHelper* favicon_tab_helper =
@@ -281,9 +297,9 @@ void GetShortcutInfoForTab(content::WebContents* web_contents,
void UpdateShortcutForTabContents(content::WebContents* web_contents) {}
#endif
-ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile(
+web_app::ShortcutInfo ShortcutInfoForExtensionAndProfile(
const extensions::Extension* app, Profile* profile) {
- ShellIntegration::ShortcutInfo shortcut_info;
+ web_app::ShortcutInfo shortcut_info;
shortcut_info.extension_id = app->id();
shortcut_info.is_platform_app = app->is_platform_app();
shortcut_info.url = extensions::AppLaunchInfo::GetLaunchWebURL(app);
@@ -341,7 +357,7 @@ base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path,
}
std::string GenerateApplicationNameFromInfo(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
if (!shortcut_info.extension_id.empty()) {
return web_app::GenerateApplicationNameFromExtensionId(
shortcut_info.extension_id);
@@ -374,8 +390,8 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name) {
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) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BrowserThread::PostTask(
@@ -388,7 +404,7 @@ void CreateShortcutsForShortcutInfo(
void CreateShortcuts(
ShortcutCreationReason reason,
- const ShellIntegration::ShortcutLocations& locations,
+ const web_app::ShortcutLocations& locations,
Profile* profile,
const extensions::Extension* app) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h
index e03846c..7c42ca1 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.
diff --git a/chrome/browser/web_applications/web_app_android.cc b/chrome/browser/web_applications/web_app_android.cc
index 2bbe042..a87793a 100644
--- a/chrome/browser/web_applications/web_app_android.cc
+++ b/chrome/browser/web_applications/web_app_android.cc
@@ -9,21 +9,21 @@ namespace internals {
bool CreatePlatformShortcuts(
const base::FilePath& web_app_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) {
return true;
}
void DeletePlatformShortcuts(
const base::FilePath& web_app_path,
- const ShellIntegration::ShortcutInfo& shortcut_info) {}
+ const web_app::ShortcutInfo& shortcut_info) {}
void UpdatePlatformShortcuts(
const base::FilePath& web_app_path,
const base::string16& old_app_title,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {}
void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {}
diff --git a/chrome/browser/web_applications/web_app_chromeos.cc b/chrome/browser/web_applications/web_app_chromeos.cc
index 5e81f50..717c29d 100644
--- a/chrome/browser/web_applications/web_app_chromeos.cc
+++ b/chrome/browser/web_applications/web_app_chromeos.cc
@@ -9,21 +9,21 @@ namespace internals {
bool CreatePlatformShortcuts(
const base::FilePath& web_app_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) {
return true;
}
void DeletePlatformShortcuts(
const base::FilePath& web_app_path,
- const ShellIntegration::ShortcutInfo& shortcut_info) {}
+ const web_app::ShortcutInfo& shortcut_info) {}
void UpdatePlatformShortcuts(
const base::FilePath& web_app_path,
const base::string16& old_app_title,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {}
void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {}
diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc
index 1b179b0..680ce7f 100644
--- a/chrome/browser/web_applications/web_app_linux.cc
+++ b/chrome/browser/web_applications/web_app_linux.cc
@@ -15,9 +15,9 @@ namespace internals {
bool CreatePlatformShortcuts(
const base::FilePath& web_app_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*/) {
#if !defined(OS_CHROMEOS)
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
@@ -30,7 +30,7 @@ bool CreatePlatformShortcuts(
void DeletePlatformShortcuts(
const base::FilePath& web_app_path,
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
#if !defined(OS_CHROMEOS)
ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path,
shortcut_info.extension_id);
@@ -40,14 +40,14 @@ void DeletePlatformShortcuts(
void UpdatePlatformShortcuts(
const base::FilePath& web_app_path,
const base::string16& /*old_app_title*/,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
scoped_ptr<base::Environment> env(base::Environment::Create());
// Find out whether shortcuts are already installed.
- ShellIntegration::ShortcutLocations creation_locations =
+ web_app::ShortcutLocations creation_locations =
ShellIntegrationLinux::GetExistingShortcutLocations(
env.get(), shortcut_info.profile_path, shortcut_info.extension_id);
// Always create a hidden shortcut in applications if a visible one is not
diff --git a/chrome/browser/web_applications/web_app_mac.h b/chrome/browser/web_applications/web_app_mac.h
index f47f64f..a85bd95 100644
--- a/chrome/browser/web_applications/web_app_mac.h
+++ b/chrome/browser/web_applications/web_app_mac.h
@@ -11,7 +11,6 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
-#include "chrome/browser/shell_integration.h"
#include "chrome/browser/web_applications/web_app.h"
namespace web_app {
@@ -19,10 +18,10 @@ namespace web_app {
// Returns the full path of the .app shim that would be created by
// web_app::CreateShortcuts().
base::FilePath GetAppInstallPath(
- const ShellIntegration::ShortcutInfo& shortcut_info);
+ const web_app::ShortcutInfo& shortcut_info);
// If necessary, launch the shortcut for an app.
-void MaybeLaunchShortcut(const ShellIntegration::ShortcutInfo& shortcut_info);
+void MaybeLaunchShortcut(const web_app::ShortcutInfo& shortcut_info);
// Creates a shortcut for a web application. The shortcut is a stub app
// that simply loads the browser framework and runs the given app.
@@ -33,7 +32,7 @@ class WebAppShortcutCreator {
// |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle.
WebAppShortcutCreator(
const base::FilePath& app_data_dir,
- const ShellIntegration::ShortcutInfo& shortcut_info);
+ const web_app::ShortcutInfo& shortcut_info);
virtual ~WebAppShortcutCreator();
@@ -51,7 +50,7 @@ class WebAppShortcutCreator {
base::FilePath GetInternalShortcutPath() const;
bool CreateShortcuts(ShortcutCreationReason creation_reason,
- ShellIntegration::ShortcutLocations creation_locations);
+ web_app::ShortcutLocations creation_locations);
void DeleteShortcuts();
bool UpdateShortcuts();
@@ -101,7 +100,7 @@ class WebAppShortcutCreator {
base::FilePath app_data_dir_;
// Information about the app.
- ShellIntegration::ShortcutInfo info_;
+ web_app::ShortcutInfo info_;
DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreator);
};
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index 28ad885..b5241c8 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -26,6 +26,7 @@
#include "base/strings/utf_string_conversions.h"
#import "chrome/browser/mac/dock.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -203,7 +204,7 @@ bool HasSameUserDataDir(const base::FilePath& bundle_path) {
}
void LaunchShimOnFileThread(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
base::FilePath shim_path = web_app::GetAppInstallPath(shortcut_info);
@@ -388,11 +389,11 @@ std::vector<base::FilePath> GetAllAppBundlesInPath(
return bundle_paths;
}
-ShellIntegration::ShortcutInfo BuildShortcutInfoFromBundle(
+web_app::ShortcutInfo BuildShortcutInfoFromBundle(
const base::FilePath& bundle_path) {
NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path));
- ShellIntegration::ShortcutInfo shortcut_info;
+ web_app::ShortcutInfo shortcut_info;
shortcut_info.extension_id = base::SysNSStringToUTF8(
[plist valueForKey:app_mode::kCrAppModeShortcutIDKey]);
shortcut_info.is_platform_app = true;
@@ -428,7 +429,7 @@ void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow /*parent_window*/,
// Normally we would show a dialog, but since we always create the app
// shortcut in ~/Applications there are no options for the user to choose.
web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER,
- ShellIntegration::ShortcutLocations(),
+ web_app::ShortcutLocations(),
profile,
app);
if (!close_callback.is_null())
@@ -441,7 +442,7 @@ namespace web_app {
WebAppShortcutCreator::WebAppShortcutCreator(
const base::FilePath& app_data_dir,
- const ShellIntegration::ShortcutInfo& shortcut_info)
+ const web_app::ShortcutInfo& shortcut_info)
: app_data_dir_(app_data_dir),
info_(shortcut_info) {}
@@ -521,7 +522,7 @@ size_t WebAppShortcutCreator::CreateShortcutsIn(
bool WebAppShortcutCreator::CreateShortcuts(
ShortcutCreationReason creation_reason,
- ShellIntegration::ShortcutLocations creation_locations) {
+ web_app::ShortcutLocations creation_locations) {
const base::FilePath applications_dir = GetApplicationsDirname();
if (applications_dir.empty() ||
!base::DirectoryExists(applications_dir.DirName())) {
@@ -794,12 +795,12 @@ void WebAppShortcutCreator::RevealAppShimInFinder() const {
}
base::FilePath GetAppInstallPath(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
WebAppShortcutCreator shortcut_creator(base::FilePath(), shortcut_info);
return shortcut_creator.GetApplicationsShortcutPath();
}
-void MaybeLaunchShortcut(const ShellIntegration::ShortcutInfo& shortcut_info) {
+void MaybeLaunchShortcut(const web_app::ShortcutInfo& shortcut_info) {
if (!apps::IsAppShimsEnabled())
return;
@@ -812,9 +813,9 @@ namespace internals {
bool CreatePlatformShortcuts(
const base::FilePath& app_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) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info);
@@ -823,7 +824,7 @@ bool CreatePlatformShortcuts(
void DeletePlatformShortcuts(
const base::FilePath& app_data_path,
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info);
shortcut_creator.DeleteShortcuts();
@@ -832,7 +833,7 @@ void DeletePlatformShortcuts(
void UpdatePlatformShortcuts(
const base::FilePath& app_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) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info);
@@ -846,7 +847,7 @@ void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
for (std::vector<base::FilePath>::const_iterator it = bundles.begin();
it != bundles.end(); ++it) {
- ShellIntegration::ShortcutInfo shortcut_info =
+ web_app::ShortcutInfo shortcut_info =
BuildShortcutInfoFromBundle(*it);
WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info);
shortcut_creator.DeleteShortcuts();
diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm
index 4633837..a6fee07 100644
--- a/chrome/browser/web_applications/web_app_mac_unittest.mm
+++ b/chrome/browser/web_applications/web_app_mac_unittest.mm
@@ -37,7 +37,7 @@ class WebAppShortcutCreatorMock : public web_app::WebAppShortcutCreator {
public:
explicit WebAppShortcutCreatorMock(
const base::FilePath& app_data_dir,
- const ShellIntegration::ShortcutInfo& shortcut_info)
+ const web_app::ShortcutInfo& shortcut_info)
: WebAppShortcutCreator(app_data_dir,
shortcut_info) {
}
@@ -51,8 +51,8 @@ class WebAppShortcutCreatorMock : public web_app::WebAppShortcutCreator {
DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreatorMock);
};
-ShellIntegration::ShortcutInfo GetShortcutInfo() {
- ShellIntegration::ShortcutInfo info;
+web_app::ShortcutInfo GetShortcutInfo() {
+ web_app::ShortcutInfo info;
info.extension_id = "extensionid";
info.extension_path = base::FilePath("/fake/extension/path");
info.title = base::ASCIIToUTF16("Shortcut Title");
@@ -87,7 +87,7 @@ class WebAppShortcutCreatorTest : public testing::Test {
base::FilePath app_data_dir_;
base::FilePath destination_dir_;
- ShellIntegration::ShortcutInfo info_;
+ web_app::ShortcutInfo info_;
base::FilePath shim_base_name_;
base::FilePath internal_shim_path_;
base::FilePath shim_path_;
@@ -107,7 +107,7 @@ TEST_F(WebAppShortcutCreatorTest, CreateShortcuts) {
.WillRepeatedly(Return(destination_dir_));
EXPECT_TRUE(shortcut_creator.CreateShortcuts(
- SHORTCUT_CREATION_AUTOMATED, ShellIntegration::ShortcutLocations()));
+ SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations()));
EXPECT_TRUE(base::PathExists(shim_path_));
EXPECT_TRUE(base::PathExists(destination_dir_));
EXPECT_EQ(shim_base_name_, shortcut_creator.GetShortcutBasename());
@@ -191,7 +191,7 @@ TEST_F(WebAppShortcutCreatorTest, DeleteShortcuts) {
.WillOnce(Return(other_shim_path));
EXPECT_TRUE(shortcut_creator.CreateShortcuts(
- SHORTCUT_CREATION_AUTOMATED, ShellIntegration::ShortcutLocations()));
+ SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations()));
EXPECT_TRUE(base::PathExists(internal_shim_path_));
EXPECT_TRUE(base::PathExists(shim_path_));
@@ -237,7 +237,7 @@ TEST_F(WebAppShortcutCreatorTest, RunShortcut) {
.WillRepeatedly(Return(destination_dir_));
EXPECT_TRUE(shortcut_creator.CreateShortcuts(
- SHORTCUT_CREATION_AUTOMATED, ShellIntegration::ShortcutLocations()));
+ SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations()));
EXPECT_TRUE(base::PathExists(shim_path_));
ssize_t status = getxattr(
@@ -254,7 +254,7 @@ TEST_F(WebAppShortcutCreatorTest, CreateFailure) {
EXPECT_CALL(shortcut_creator, GetApplicationsDirname())
.WillRepeatedly(Return(non_existent_path));
EXPECT_FALSE(shortcut_creator.CreateShortcuts(
- SHORTCUT_CREATION_AUTOMATED, ShellIntegration::ShortcutLocations()));
+ SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations()));
}
TEST_F(WebAppShortcutCreatorTest, UpdateIcon) {
@@ -283,11 +283,11 @@ TEST_F(WebAppShortcutCreatorTest, RevealAppShimInFinder) {
EXPECT_CALL(shortcut_creator, RevealAppShimInFinder())
.Times(0);
EXPECT_TRUE(shortcut_creator.CreateShortcuts(
- SHORTCUT_CREATION_AUTOMATED, ShellIntegration::ShortcutLocations()));
+ SHORTCUT_CREATION_AUTOMATED, web_app::ShortcutLocations()));
EXPECT_CALL(shortcut_creator, RevealAppShimInFinder());
EXPECT_TRUE(shortcut_creator.CreateShortcuts(
- SHORTCUT_CREATION_BY_USER, ShellIntegration::ShortcutLocations()));
+ SHORTCUT_CREATION_BY_USER, web_app::ShortcutLocations()));
}
} // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc
index 4866102..6377c16b 100644
--- a/chrome/browser/web_applications/web_app_unittest.cc
+++ b/chrome/browser/web_applications/web_app_unittest.cc
@@ -43,7 +43,7 @@ TEST_F(WebApplicationTest, MAYBE_GetShortcutInfoForTab) {
RenderViewHostTester::TestOnMessageReceived(
rvh(),
ChromeExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info));
- ShellIntegration::ShortcutInfo info;
+ web_app::ShortcutInfo info;
web_app::GetShortcutInfoForTab(web_contents(), &info);
EXPECT_EQ(title, info.title);
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index 5114696..87bd00b 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -18,7 +18,6 @@
#include "base/win/shortcut.h"
#include "base/win/windows_version.h"
#include "chrome/browser/web_applications/update_shortcut_worker_win.h"
-#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/shell_util.h"
@@ -161,7 +160,7 @@ std::vector<base::FilePath> FindAppShortcutsByProfileAndTitle(
// Must be called on the FILE thread.
bool CreateShortcutsInPaths(
const base::FilePath& web_app_path,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const std::vector<base::FilePath>& shortcut_paths,
web_app::ShortcutCreationReason creation_reason,
std::vector<base::FilePath>* out_filenames) {
@@ -279,14 +278,14 @@ void GetShortcutLocationsAndDeleteShortcuts(
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
// Get all possible locations for shortcuts.
- ShellIntegration::ShortcutLocations all_shortcut_locations;
+ web_app::ShortcutLocations all_shortcut_locations;
all_shortcut_locations.in_quick_launch_bar = true;
all_shortcut_locations.on_desktop = true;
// Delete shortcuts from the Chrome Apps subdirectory.
// This matches the subdir name set by CreateApplicationShortcutView::Accept
// for Chrome apps (not URL apps, but this function does not apply for them).
all_shortcut_locations.applications_menu_location =
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
std::vector<base::FilePath> all_paths = web_app::internals::GetShortcutPaths(
all_shortcut_locations);
if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
@@ -330,7 +329,7 @@ namespace web_app {
base::FilePath CreateShortcutInWebAppDir(
const base::FilePath& web_app_dir,
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
std::vector<base::FilePath> paths;
paths.push_back(web_app_dir);
std::vector<base::FilePath> out_filenames;
@@ -377,9 +376,9 @@ bool CheckAndSaveIcon(const base::FilePath& icon_file,
bool CreatePlatformShortcuts(
const base::FilePath& web_app_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) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
@@ -420,7 +419,7 @@ bool CreatePlatformShortcuts(
void UpdatePlatformShortcuts(
const base::FilePath& web_app_path,
const base::string16& old_app_title,
- const ShellIntegration::ShortcutInfo& shortcut_info,
+ const web_app::ShortcutInfo& shortcut_info,
const extensions::FileHandlersInfo& file_handlers_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
@@ -459,7 +458,7 @@ void UpdatePlatformShortcuts(
void DeletePlatformShortcuts(
const base::FilePath& web_app_path,
- const ShellIntegration::ShortcutInfo& shortcut_info) {
+ const web_app::ShortcutInfo& shortcut_info) {
GetShortcutLocationsAndDeleteShortcuts(
web_app_path, shortcut_info.profile_path, shortcut_info.title, NULL,
NULL);
@@ -493,7 +492,7 @@ void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
}
std::vector<base::FilePath> GetShortcutPaths(
- const ShellIntegration::ShortcutLocations& creation_locations) {
+ const web_app::ShortcutLocations& creation_locations) {
// Shortcut paths under which to create shortcuts.
std::vector<base::FilePath> shortcut_paths;
// Locations to add to shortcut_paths.
@@ -506,15 +505,15 @@ std::vector<base::FilePath> GetShortcutPaths(
ShellUtil::SHORTCUT_LOCATION_DESKTOP
}, {
creation_locations.applications_menu_location ==
- ShellIntegration::APP_MENU_LOCATION_ROOT,
+ web_app::APP_MENU_LOCATION_ROOT,
ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT
}, {
creation_locations.applications_menu_location ==
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROME,
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROME,
ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR
}, {
creation_locations.applications_menu_location ==
- ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS,
+ web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS,
ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR
}, {
// For Win7+, |in_quick_launch_bar| indicates that we are pinning to
diff --git a/chrome/browser/web_applications/web_app_win.h b/chrome/browser/web_applications/web_app_win.h
index 4f4c541..7e87c29 100644
--- a/chrome/browser/web_applications/web_app_win.h
+++ b/chrome/browser/web_applications/web_app_win.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_WIN_H_
#include "base/files/file_path.h"
-#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/web_applications/web_app.h"
namespace content {
class WebContents;
@@ -22,7 +22,7 @@ namespace web_app {
// created shortcut.
base::FilePath CreateShortcutInWebAppDir(
const base::FilePath& web_app_path,
- const ShellIntegration::ShortcutInfo& shortcut_info);
+ const web_app::ShortcutInfo& shortcut_info);
namespace internals {