Index: chrome/browser/ui/app_list/app_list_view_delegate.cc |
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 4c24cb262784ad1b0aaa3321ac49834b2de908c2..3bd887ca6c7ff0f4c1ccd3fade56ebaf6ee9bd6d 100644 |
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc |
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
+#include "base/files/file_path.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/feedback/feedback_util.h" |
@@ -16,8 +17,11 @@ |
#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/chrome_pages.h" |
#include "chrome/browser/ui/host_desktop.h" |
+#include "chrome/browser/ui/web_applications/web_app_ui.h" |
+#include "chrome/browser/web_applications/web_app.h" |
#include "chrome/common/extensions/extension_constants.h" |
#include "chrome/common/url_constants.h" |
+#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/page_navigator.h" |
#include "content/public/browser/user_metrics.h" |
@@ -25,6 +29,22 @@ |
#include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
#endif |
+ |
+namespace { |
+ |
+void CreateShortcutInWebAppDir( |
+ const base::FilePath& app_data_dir, |
+ base::Callback<void(const base::FilePath&)> callback, |
+ const ShellIntegration::ShortcutInfo& info) { |
+ content::BrowserThread::PostTaskAndReplyWithResult( |
+ content::BrowserThread::FILE, |
+ FROM_HERE, |
+ base::Bind(web_app::CreateShortcutInWebAppDir, app_data_dir, info), |
+ callback); |
+} |
+ |
+} // namespace |
+ |
AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller, |
Profile* profile) |
: controller_(controller), |
@@ -68,6 +88,26 @@ void AppListViewDelegate::ActivateAppListItem( |
static_cast<ChromeAppListItem*>(item)->Activate(event_flags); |
} |
+void AppListViewDelegate::GetShortcutPathForApp( |
+ const std::string& app_id, |
+ base::Callback<void(const base::FilePath&)> callback) { |
+ ExtensionService* service = profile_->GetExtensionService(); |
+ DCHECK(service); |
+ const extensions::Extension* extension = |
+ service->GetInstalledExtension(app_id); |
+ DCHECK(extension); |
+ |
+ base::FilePath app_data_dir( |
+ web_app::GetWebAppDataDirectory(profile_->GetPath(), |
+ extension->id(), |
+ GURL())); |
+ |
+ web_app::UpdateShortcutInfoAndIconForApp( |
+ *extension, |
+ profile_, |
+ base::Bind(CreateShortcutInWebAppDir, app_data_dir, callback)); |
+} |
+ |
void AppListViewDelegate::StartSearch() { |
if (search_controller_.get()) |
search_controller_->Start(); |