| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 !base::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 = |
| 295 FILE_PATH_LITERAL(".ico")); | 295 web_app::internals::GetIconFilePath(web_app_path, shortcut_info_.title); |
| 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(); |
| 300 if (!shortcut_files_.empty()) { | 300 if (!shortcut_files_.empty()) { |
| 301 // Generates app id from web app url and profile path. | 301 // Generates app id from web app url and profile path. |
| 302 base::string16 app_id = ShellIntegration::GetAppModelIdForProfile( | 302 base::string16 app_id = ShellIntegration::GetAppModelIdForProfile( |
| 303 base::UTF8ToWide( | 303 base::UTF8ToWide( |
| 304 web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), | 304 web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), |
| 305 profile_path_); | 305 profile_path_); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // |info_list| may still be empty at this point, in which case | 470 // |info_list| may still be empty at this point, in which case |
| 471 // LoadImageFamilyAsync will call the OnImageLoaded callback with an empty | 471 // LoadImageFamilyAsync will call the OnImageLoaded callback with an empty |
| 472 // image and exit immediately. | 472 // image and exit immediately. |
| 473 extensions::ImageLoader::Get(profile)->LoadImageFamilyAsync( | 473 extensions::ImageLoader::Get(profile)->LoadImageFamilyAsync( |
| 474 extension, | 474 extension, |
| 475 info_list, | 475 info_list, |
| 476 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 476 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace web_app | 479 } // namespace web_app |
| OLD | NEW |