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

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

Issue 9374009: Install platform apps into a separate data directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, address review comments Created 8 years, 10 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 e7fbb344b101f319b8b1d811f2f850b94ab6bfca..eb89ba87c4419ba7a32f4c26cd353fc460c02a4f 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -19,10 +19,10 @@ using content::BrowserThread;
namespace {
// Returns relative directory of given web app url.
-FilePath GetWebAppDir(const ShellIntegration::ShortcutInfo& info) {
- if (!info.extension_id.empty()) {
+FilePath GetWebAppDir(const std::string& extension_id, const GURL& url) {
+ if (!extension_id.empty()) {
std::string app_name =
- web_app::GenerateApplicationNameFromExtensionId(info.extension_id);
+ web_app::GenerateApplicationNameFromExtensionId(extension_id);
#if defined(OS_WIN)
return FilePath(UTF8ToUTF16(app_name));
#elif defined(OS_POSIX)
@@ -33,13 +33,13 @@ FilePath GetWebAppDir(const ShellIntegration::ShortcutInfo& info) {
FilePath::StringType scheme_port;
#if defined(OS_WIN)
- host = UTF8ToUTF16(info.url.host());
- scheme_port = (info.url.has_scheme() ? UTF8ToUTF16(info.url.scheme())
+ host = UTF8ToUTF16(url.host());
+ scheme_port = (url.has_scheme() ? UTF8ToUTF16(url.scheme())
: L"http") + FILE_PATH_LITERAL("_") +
- (info.url.has_port() ? UTF8ToUTF16(info.url.port()) : L"80");
+ (url.has_port() ? UTF8ToUTF16(url.port()) : L"80");
#elif defined(OS_POSIX)
- host = info.url.host();
- scheme_port = info.url.scheme() + FILE_PATH_LITERAL("_") + info.url.port();
+ host = url.host();
+ scheme_port = url.scheme() + FILE_PATH_LITERAL("_") + url.port();
#endif
return FilePath(host).Append(scheme_port);
@@ -68,12 +68,6 @@ static const char* kCrxAppPrefix = "_crx_";
namespace internals {
-// Returns data directory for given web app url
-FilePath GetWebAppDataDirectory(const FilePath& root_dir,
- const ShellIntegration::ShortcutInfo& info) {
- return root_dir.Append(GetWebAppDir(info));
-}
-
FilePath GetSanitizedFileName(const string16& name) {
#if defined(OS_WIN)
string16 file_name = name;
@@ -86,6 +80,12 @@ FilePath GetSanitizedFileName(const string16& name) {
} // namespace internals
+FilePath GetWebAppDataDirectory(const FilePath& profile_path,
+ const std::string& extension_id,
+ const GURL& url) {
+ return GetDataDir(profile_path).Append(GetWebAppDir(extension_id, url));
+}
+
std::string GenerateApplicationNameFromInfo(
const ShellIntegration::ShortcutInfo& shortcut_info) {
if (!shortcut_info.extension_id.empty()) {
@@ -125,9 +125,10 @@ void CreateShortcut(
BrowserThread::FILE,
FROM_HERE,
base::Bind(&internals::CreateShortcutTask,
- web_app::internals::GetWebAppDataDirectory(
- web_app::GetDataDir(data_dir),
- shortcut_info),
+ GetWebAppDataDirectory(
+ data_dir,
+ shortcut_info.extension_id,
+ shortcut_info.url),
data_dir,
shortcut_info));
}

Powered by Google App Engine
This is Rietveld 408576698