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

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: Create updated shortcuts from NTP, add enable flag Created 8 years, 9 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
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 4ff951f7fa94b7842d33e402e9d588b4c9acd2d5..928556fc3533b9f7a58e51aa7ff694722e9e9b08 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)) {
sail 2012/04/12 15:06:29 is this really necessary? on the Mac the data dire
benwells 2012/04/13 01:48:48 Yes, some files are put in this folder at shortcut
sail 2012/04/13 01:59:14 ok
+ return false;
+ }
+ return internals::CreatePlatformShortcut(
+ shortcut_data_dir, profile_path, shortcut_info);
+}
+
bool IsValidUrl(const GURL& url) {
static const char* const kValidUrlSchemes[] = {
chrome::kFileScheme,

Powered by Google App Engine
This is Rietveld 408576698