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

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: fix comment 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 3f23e65d9baf6aaa866a8b221957bd5bd8e5a30a..89107a1793416e45455eb11fb08ee9882616b81f 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -23,10 +23,10 @@ namespace {
bool disable_shortcut_creation_for_tests = false;
// 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(UTF8ToWide(app_name));
#elif defined(OS_POSIX)
@@ -37,13 +37,13 @@ FilePath GetWebAppDir(const ShellIntegration::ShortcutInfo& info) {
FilePath::StringType scheme_port;
#if defined(OS_WIN)
- host = UTF8ToWide(info.url.host());
- scheme_port = (info.url.has_scheme() ? UTF8ToWide(info.url.scheme())
+ host = UTF8ToWide(url.host());
+ scheme_port = (url.has_scheme() ? UTF8ToWide(url.scheme())
: L"http") + FILE_PATH_LITERAL("_") +
- (info.url.has_port() ? UTF8ToWide(info.url.port()) : L"80");
+ (url.has_port() ? UTF8ToWide(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);
@@ -72,12 +72,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;
@@ -90,6 +84,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()) {
@@ -132,9 +132,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