| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( | 276 base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( |
| 277 FILE_PATH_LITERAL(".ico")); | 277 FILE_PATH_LITERAL(".ico")); |
| 278 web_app::internals::CheckAndSaveIcon(icon_file, | 278 web_app::internals::CheckAndSaveIcon(icon_file, |
| 279 *shortcut_info_.favicon.ToSkBitmap()); | 279 *shortcut_info_.favicon.ToSkBitmap()); |
| 280 | 280 |
| 281 // Update existing shortcuts' description, icon and app id. | 281 // Update existing shortcuts' description, icon and app id. |
| 282 CheckExistingShortcuts(); | 282 CheckExistingShortcuts(); |
| 283 if (!shortcut_files_.empty()) { | 283 if (!shortcut_files_.empty()) { |
| 284 // Generates app id from web app url and profile path. | 284 // Generates app id from web app url and profile path. |
| 285 string16 app_id = ShellIntegration::GetAppModelIdForProfile( | 285 string16 app_id = ShellIntegration::GetAppModelIdForProfile( |
| 286 UTF8ToWide(web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), | 286 base::UTF8ToWide(web_app::GenerateApplicationNameFromURL( |
| 287 shortcut_info_.url)), |
| 287 profile_path_); | 288 profile_path_); |
| 288 | 289 |
| 289 // Sanitize description | 290 // Sanitize description |
| 290 if (shortcut_info_.description.length() >= MAX_PATH) | 291 if (shortcut_info_.description.length() >= MAX_PATH) |
| 291 shortcut_info_.description.resize(MAX_PATH - 1); | 292 shortcut_info_.description.resize(MAX_PATH - 1); |
| 292 | 293 |
| 293 for (size_t i = 0; i < shortcut_files_.size(); ++i) { | 294 for (size_t i = 0; i < shortcut_files_.size(); ++i) { |
| 294 base::win::ShortcutProperties shortcut_properties; | 295 base::win::ShortcutProperties shortcut_properties; |
| 295 shortcut_properties.set_target(shortcut_files_[i]); | 296 shortcut_properties.set_target(shortcut_files_[i]); |
| 296 shortcut_properties.set_description(shortcut_info_.description); | 297 shortcut_properties.set_description(shortcut_info_.description); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 } | 446 } |
| 446 | 447 |
| 447 // |info_list| may still be empty at this point, in which case LoadImage | 448 // |info_list| may still be empty at this point, in which case LoadImage |
| 448 // will call the OnImageLoaded callback with an empty image and exit | 449 // will call the OnImageLoaded callback with an empty image and exit |
| 449 // immediately. | 450 // immediately. |
| 450 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 451 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
| 451 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 452 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
| 452 } | 453 } |
| 453 | 454 |
| 454 } // namespace web_app | 455 } // namespace web_app |
| OLD | NEW |