OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/update_shortcut_worker_win.h" | 5 #include "chrome/browser/web_applications/update_shortcut_worker_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Ensure web_app_path exists. web_app_path could be missing for a legacy | 185 // Ensure web_app_path exists. web_app_path could be missing for a legacy |
186 // shortcut created by Gears. | 186 // shortcut created by Gears. |
187 if (!base::PathExists(web_app_path) && | 187 if (!base::PathExists(web_app_path) && |
188 !base::CreateDirectory(web_app_path)) { | 188 !base::CreateDirectory(web_app_path)) { |
189 NOTREACHED(); | 189 NOTREACHED(); |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 base::FilePath icon_file = | 193 base::FilePath icon_file = |
194 web_app::internals::GetIconFilePath(web_app_path, shortcut_info_.title); | 194 web_app::internals::GetIconFilePath(web_app_path, shortcut_info_.title); |
195 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon); | 195 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon, true); |
196 | 196 |
197 // Update existing shortcuts' description, icon and app id. | 197 // Update existing shortcuts' description, icon and app id. |
198 CheckExistingShortcuts(); | 198 CheckExistingShortcuts(); |
199 if (!shortcut_files_.empty()) { | 199 if (!shortcut_files_.empty()) { |
200 // Generates app id from web app url and profile path. | 200 // Generates app id from web app url and profile path. |
201 base::string16 app_id = ShellIntegration::GetAppModelIdForProfile( | 201 base::string16 app_id = ShellIntegration::GetAppModelIdForProfile( |
202 base::UTF8ToWide( | 202 base::UTF8ToWide( |
203 web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), | 203 web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), |
204 profile_path_); | 204 profile_path_); |
205 | 205 |
(...skipping 29 matching lines...) Expand all Loading... |
235 base::Unretained(this))); | 235 base::Unretained(this))); |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 void UpdateShortcutWorker::DeleteMeOnUIThread() { | 239 void UpdateShortcutWorker::DeleteMeOnUIThread() { |
240 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 240 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
241 delete this; | 241 delete this; |
242 } | 242 } |
243 | 243 |
244 } // namespace web_app | 244 } // namespace web_app |
OLD | NEW |