OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_sync_service.h" | 5 #include "chrome/browser/extensions/extension_sync_service.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 web_app_info.app_url = bookmark_app_url; | 411 web_app_info.app_url = bookmark_app_url; |
412 web_app_info.title = | 412 web_app_info.title = |
413 base::UTF8ToUTF16(app_sync_data.extension_sync_data().name()); | 413 base::UTF8ToUTF16(app_sync_data.extension_sync_data().name()); |
414 web_app_info.description = | 414 web_app_info.description = |
415 base::UTF8ToUTF16(app_sync_data.bookmark_app_description()); | 415 base::UTF8ToUTF16(app_sync_data.bookmark_app_description()); |
416 if (!app_sync_data.bookmark_app_icon_color().empty()) { | 416 if (!app_sync_data.bookmark_app_icon_color().empty()) { |
417 extensions::image_util::ParseCSSColorString( | 417 extensions::image_util::ParseCSSColorString( |
418 app_sync_data.bookmark_app_icon_color(), | 418 app_sync_data.bookmark_app_icon_color(), |
419 &web_app_info.generated_icon_color); | 419 &web_app_info.generated_icon_color); |
420 } | 420 } |
| 421 for (const auto& icon : app_sync_data.linked_icons()) { |
| 422 WebApplicationInfo::IconInfo icon_info; |
| 423 icon_info.url = icon.url; |
| 424 icon_info.width = icon.size; |
| 425 icon_info.height = icon.size; |
| 426 web_app_info.icons.push_back(icon_info); |
| 427 } |
421 | 428 |
422 // If the bookmark app already exists, keep the old icons. | 429 // If the bookmark app already exists, keep the old icons. |
423 if (!extension) { | 430 if (!extension) { |
424 CreateOrUpdateBookmarkApp(extension_service_, &web_app_info); | 431 CreateOrUpdateBookmarkApp(extension_service_, &web_app_info); |
425 } else { | 432 } else { |
426 app_sync_data.extension_sync_data().name(); | 433 app_sync_data.extension_sync_data().name(); |
427 GetWebApplicationInfoFromApp(profile_, | 434 GetWebApplicationInfoFromApp(profile_, |
428 extension, | 435 extension, |
429 base::Bind(&OnWebApplicationInfoLoaded, | 436 base::Bind(&OnWebApplicationInfoLoaded, |
430 web_app_info, | 437 web_app_info, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 app_sync_bundle_.SyncChangeIfNeeded(extension); | 589 app_sync_bundle_.SyncChangeIfNeeded(extension); |
583 else if (extension_service_->is_ready() && !flare_.is_null()) | 590 else if (extension_service_->is_ready() && !flare_.is_null()) |
584 flare_.Run(syncer::APPS); | 591 flare_.Run(syncer::APPS); |
585 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { | 592 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { |
586 if (extension_sync_bundle_.IsSyncing()) | 593 if (extension_sync_bundle_.IsSyncing()) |
587 extension_sync_bundle_.SyncChangeIfNeeded(extension); | 594 extension_sync_bundle_.SyncChangeIfNeeded(extension); |
588 else if (extension_service_->is_ready() && !flare_.is_null()) | 595 else if (extension_service_->is_ready() && !flare_.is_null()) |
589 flare_.Run(syncer::EXTENSIONS); | 596 flare_.Run(syncer::EXTENSIONS); |
590 } | 597 } |
591 } | 598 } |
OLD | NEW |