Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8890)

Unified Diff: chrome/browser/web_applications/web_app.cc

Issue 9958006: Create Linux platform app shortcuts to run in their own process. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moved new function into shell_integration_linux.h Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/web_applications/web_app.h ('k') | chrome/browser/web_applications/web_app_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/web_applications/web_app.h ('k') | chrome/browser/web_applications/web_app_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698