| 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/ui/web_applications/web_app_ui.h" | 5 #include "chrome/browser/ui/web_applications/web_app_ui.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/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { | 280 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { |
| 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 282 | 282 |
| 283 base::FilePath web_app_path = web_app::GetWebAppDataDirectory( | 283 base::FilePath web_app_path = web_app::GetWebAppDataDirectory( |
| 284 profile_path_, shortcut_info_.extension_id, shortcut_info_.url); | 284 profile_path_, shortcut_info_.extension_id, shortcut_info_.url); |
| 285 | 285 |
| 286 // Ensure web_app_path exists. web_app_path could be missing for a legacy | 286 // Ensure web_app_path exists. web_app_path could be missing for a legacy |
| 287 // shortcut created by Gears. | 287 // shortcut created by Gears. |
| 288 if (!base::PathExists(web_app_path) && | 288 if (!base::PathExists(web_app_path) && |
| 289 !file_util::CreateDirectory(web_app_path)) { | 289 !base::CreateDirectory(web_app_path)) { |
| 290 NOTREACHED(); | 290 NOTREACHED(); |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 | 293 |
| 294 base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( | 294 base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( |
| 295 FILE_PATH_LITERAL(".ico")); | 295 FILE_PATH_LITERAL(".ico")); |
| 296 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon); | 296 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon); |
| 297 | 297 |
| 298 // Update existing shortcuts' description, icon and app id. | 298 // Update existing shortcuts' description, icon and app id. |
| 299 CheckExistingShortcuts(); | 299 CheckExistingShortcuts(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 488 } |
| 489 | 489 |
| 490 // |info_list| may still be empty at this point, in which case LoadImage | 490 // |info_list| may still be empty at this point, in which case LoadImage |
| 491 // will call the OnImageLoaded callback with an empty image and exit | 491 // will call the OnImageLoaded callback with an empty image and exit |
| 492 // immediately. | 492 // immediately. |
| 493 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 493 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
| 494 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 494 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace web_app | 497 } // namespace web_app |
| OLD | NEW |