| 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" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 void CreateShortcut( | 121 void CreateShortcut( |
| 122 const FilePath& profile_path, | 122 const FilePath& profile_path, |
| 123 const ShellIntegration::ShortcutInfo& shortcut_info) { | 123 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 125 | 125 |
| 126 BrowserThread::PostTask( | 126 BrowserThread::PostTask( |
| 127 BrowserThread::FILE, | 127 BrowserThread::FILE, |
| 128 FROM_HERE, | 128 FROM_HERE, |
| 129 base::Bind(base::IgnoreResult(&CreateShortcutOnFileThread), | 129 base::Bind(base::IgnoreResult(&CreateShortcutOnFileThread), |
| 130 profile_path, | 130 profile_path, shortcut_info)); |
| 131 shortcut_info)); | 131 } |
| 132 |
| 133 void DeleteAllShortcuts(const FilePath& profile_path, |
| 134 const std::string& extension_id) { |
| 135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 136 |
| 137 BrowserThread::PostTask( |
| 138 BrowserThread::FILE, |
| 139 FROM_HERE, |
| 140 base::Bind(&internals::DeletePlatformShortcuts, profile_path, |
| 141 extension_id)); |
| 132 } | 142 } |
| 133 | 143 |
| 134 bool CreateShortcutOnFileThread( | 144 bool CreateShortcutOnFileThread( |
| 135 const FilePath& profile_path, | 145 const FilePath& profile_path, |
| 136 const ShellIntegration::ShortcutInfo& shortcut_info) { | 146 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 138 | 148 |
| 139 FilePath shortcut_data_dir = GetWebAppDataDirectory( | 149 FilePath shortcut_data_dir = GetWebAppDataDirectory( |
| 140 profile_path, shortcut_info.extension_id, shortcut_info.url); | 150 profile_path, shortcut_info.extension_id, shortcut_info.url); |
| 141 return internals::CreatePlatformShortcut( | 151 return internals::CreatePlatformShortcut( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 189 |
| 180 #if defined(TOOLKIT_GTK) | 190 #if defined(TOOLKIT_GTK) |
| 181 std::string GetWMClassFromAppName(std::string app_name) { | 191 std::string GetWMClassFromAppName(std::string app_name) { |
| 182 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); | 192 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); |
| 183 TrimString(app_name, "_", &app_name); | 193 TrimString(app_name, "_", &app_name); |
| 184 return app_name; | 194 return app_name; |
| 185 } | 195 } |
| 186 #endif | 196 #endif |
| 187 | 197 |
| 188 } // namespace web_app | 198 } // namespace web_app |
| OLD | NEW |