| Index: chrome/browser/web_applications/web_app.cc
|
| diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
|
| index cbb169a91655d123ad963b321837990d7b63a57a..12e1ac694d798011d9e506bb7eec843e2fac4161 100644
|
| --- a/chrome/browser/web_applications/web_app.cc
|
| +++ b/chrome/browser/web_applications/web_app.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/web_applications/web_app.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/bind_helpers.h"
|
| #include "base/file_util.h"
|
| #include "base/i18n/file_util_icu.h"
|
| #include "base/string_util.h"
|
| @@ -118,20 +119,34 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name) {
|
| }
|
|
|
| void CreateShortcut(
|
| - const FilePath& data_dir,
|
| + const FilePath& profile_path,
|
| const ShellIntegration::ShortcutInfo& shortcut_info) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE,
|
| FROM_HERE,
|
| - base::Bind(&internals::CreateShortcutTask,
|
| - GetWebAppDataDirectory(
|
| - data_dir,
|
| - shortcut_info.extension_id,
|
| - shortcut_info.url),
|
| - data_dir,
|
| + base::Bind(base::IgnoreResult(&CreateShortcutOnFileThread),
|
| + profile_path,
|
| shortcut_info));
|
| }
|
|
|
| +bool CreateShortcutOnFileThread(
|
| + const FilePath& profile_path,
|
| + const ShellIntegration::ShortcutInfo& shortcut_info) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| +
|
| + FilePath shortcut_data_dir = GetWebAppDataDirectory(
|
| + profile_path, shortcut_info.extension_id, shortcut_info.url);
|
| + // Ensure shortcut_data_dir exists
|
| + if (!file_util::PathExists(shortcut_data_dir) &&
|
| + !file_util::CreateDirectory(shortcut_data_dir)) {
|
| + return false;
|
| + }
|
| + return internals::CreatePlatformShortcut(
|
| + shortcut_data_dir, profile_path, shortcut_info);
|
| +}
|
| +
|
| bool IsValidUrl(const GURL& url) {
|
| static const char* const kValidUrlSchemes[] = {
|
| chrome::kFileScheme,
|
|
|