diff options
author | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 22:21:32 +0000 |
---|---|---|
committer | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 22:21:32 +0000 |
commit | 9f355b3532d7290c42fae45be52691a3cf28ebeb (patch) | |
tree | 8e37fe24c5fe1c7cb1fec6798f02be11df8104fe /chrome/browser/web_applications | |
parent | 4abf5b4c8ed2e74163475a59296e8ba87c98717a (diff) | |
download | chromium_src-9f355b3532d7290c42fae45be52691a3cf28ebeb.zip chromium_src-9f355b3532d7290c42fae45be52691a3cf28ebeb.tar.gz chromium_src-9f355b3532d7290c42fae45be52691a3cf28ebeb.tar.bz2 |
[Win] App launcher drag/drop.
This allows icons to be dragged from the windows App Launcher to the taskbar.
BUG=153335
Review URL: https://chromiumcodereview.appspot.com/17370003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_applications')
-rw-r--r-- | chrome/browser/web_applications/web_app.h | 3 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.cc | 24 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.h | 32 |
3 files changed, 52 insertions, 7 deletions
diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index f4c647c..af24aef 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -101,9 +101,6 @@ string16 GetAppShortcutsSubdirName(); namespace internals { #if defined(OS_WIN) -bool CheckAndSaveIcon(const base::FilePath& icon_file, - const gfx::ImageFamily& image); - std::vector<base::FilePath> GetShortcutPaths( const ShellIntegration::ShortcutLocations& creation_locations); #endif diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 9e3c5ee..be49240 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_win.h" #include <shlobj.h> @@ -16,6 +16,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/win/shortcut.h" #include "base/win/windows_version.h" +#include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_switches.h" #include "chrome/installer/launcher_support/chrome_launcher_support.h" #include "chrome/installer/util/util_constants.h" @@ -137,7 +138,8 @@ std::vector<base::FilePath> MatchingShortcutsForProfileAndExtension( bool CreateShortcutsInPaths( const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info, - const std::vector<base::FilePath>& shortcut_paths) { + const std::vector<base::FilePath>& shortcut_paths, + std::vector<base::FilePath>* out_filenames) { // Ensure web_app_path exists. if (!file_util::PathExists(web_app_path) && !file_util::CreateDirectory(web_app_path)) { @@ -215,6 +217,8 @@ bool CreateShortcutsInPaths( success = base::win::CreateOrUpdateShortcutLink( shortcut_file, shortcut_properties, base::win::SHORTCUT_CREATE_ALWAYS) && success; + if (out_filenames) + out_filenames->push_back(shortcut_file); } return success; @@ -286,6 +290,17 @@ void GetShortcutLocationsAndDeleteShortcuts( namespace web_app { +base::FilePath CreateShortcutInWebAppDir( + const base::FilePath& web_app_dir, + const ShellIntegration::ShortcutInfo& shortcut_info) { + std::vector<base::FilePath> paths; + paths.push_back(web_app_dir); + std::vector<base::FilePath> out_filenames; + CreateShortcutsInPaths(web_app_dir, shortcut_info, paths, &out_filenames); + DCHECK_EQ(out_filenames.size(), 1u); + return out_filenames[0]; +} + namespace internals { // Saves |image| to |icon_file| if the file is outdated and refresh shell's @@ -331,7 +346,8 @@ bool CreatePlatformShortcuts( if (shortcut_paths.empty()) return false; - if (!CreateShortcutsInPaths(web_app_path, shortcut_info, shortcut_paths)) + if (!CreateShortcutsInPaths(web_app_path, shortcut_info, shortcut_paths, + NULL)) return false; if (pin_to_taskbar) { @@ -367,7 +383,7 @@ void UpdatePlatformShortcuts( GetShortcutLocationsAndDeleteShortcuts( web_app_path, shortcut_info.profile_path, old_app_title, &was_pinned_to_taskbar, &shortcut_paths); - CreateShortcutsInPaths(web_app_path, shortcut_info, shortcut_paths); + CreateShortcutsInPaths(web_app_path, shortcut_info, shortcut_paths, NULL); // If the shortcut was pinned to the taskbar, // GetShortcutLocationsAndDeleteShortcuts will have deleted it. In that // case, re-pin it. diff --git a/chrome/browser/web_applications/web_app_win.h b/chrome/browser/web_applications/web_app_win.h new file mode 100644 index 0000000..6b2cf5b --- /dev/null +++ b/chrome/browser/web_applications/web_app_win.h @@ -0,0 +1,32 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_WIN_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_WIN_H_ + +#include "base/files/file_path.h" +#include "chrome/browser/shell_integration.h" + +namespace gfx { +class ImageFamily; +} + +namespace web_app { + +// Create a shortcut in the given web app data dir, returning the name of the +// created shortcut. +base::FilePath CreateShortcutInWebAppDir( + const base::FilePath& web_app_path, + const ShellIntegration::ShortcutInfo& shortcut_info); + +namespace internals { + +bool CheckAndSaveIcon(const base::FilePath& icon_file, + const gfx::ImageFamily& image); + +} // namespace internals + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_WIN_H_ |