| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/extensions/app_launcher_info.h" |
| 15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 #include "extensions/common/constants.h" | 19 #include "extensions/common/constants.h" |
| 19 | 20 |
| 20 using content::BrowserThread; | 21 using content::BrowserThread; |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 #if defined(TOOLKIT_VIEWS) | 25 #if defined(TOOLKIT_VIEWS) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 base::FilePath::StringType host_path(host); | 99 base::FilePath::StringType host_path(host); |
| 99 base::FilePath::StringType scheme_port_path(scheme_port); | 100 base::FilePath::StringType scheme_port_path(scheme_port); |
| 100 #endif | 101 #endif |
| 101 | 102 |
| 102 return app_data_dir.Append(host_path).Append(scheme_port_path); | 103 return app_data_dir.Append(host_path).Append(scheme_port_path); |
| 103 } | 104 } |
| 104 | 105 |
| 105 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 106 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
| 106 const extensions::Extension& extension) { | 107 const extensions::Extension& extension) { |
| 107 return GetWebAppDataDirectory( | 108 return GetWebAppDataDirectory( |
| 108 profile_path, extension.id(), GURL(extension.launch_web_url())); | 109 profile_path, |
| 110 extension.id(), |
| 111 GURL(extensions::AppLauncherInfo::GetLaunchWebURL(&extension))); |
| 109 } | 112 } |
| 110 | 113 |
| 111 std::string GenerateApplicationNameFromInfo( | 114 std::string GenerateApplicationNameFromInfo( |
| 112 const ShellIntegration::ShortcutInfo& shortcut_info) { | 115 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 113 if (!shortcut_info.extension_id.empty()) { | 116 if (!shortcut_info.extension_id.empty()) { |
| 114 return web_app::GenerateApplicationNameFromExtensionId( | 117 return web_app::GenerateApplicationNameFromExtensionId( |
| 115 shortcut_info.extension_id); | 118 shortcut_info.extension_id); |
| 116 } else { | 119 } else { |
| 117 return web_app::GenerateApplicationNameFromURL( | 120 return web_app::GenerateApplicationNameFromURL( |
| 118 shortcut_info.url); | 121 shortcut_info.url); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 222 |
| 220 #if defined(TOOLKIT_GTK) | 223 #if defined(TOOLKIT_GTK) |
| 221 std::string GetWMClassFromAppName(std::string app_name) { | 224 std::string GetWMClassFromAppName(std::string app_name) { |
| 222 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); | 225 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); |
| 223 TrimString(app_name, "_", &app_name); | 226 TrimString(app_name, "_", &app_name); |
| 224 return app_name; | 227 return app_name; |
| 225 } | 228 } |
| 226 #endif | 229 #endif |
| 227 | 230 |
| 228 } // namespace web_app | 231 } // namespace web_app |
| OLD | NEW |