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