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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 CHECK(type == syncer::EXTENSIONS || type == syncer::APPS); | 519 CHECK(type == syncer::EXTENSIONS || type == syncer::APPS); |
520 extensions::PendingExtensionInfo::ShouldAllowInstallPredicate filter = | 520 extensions::PendingExtensionInfo::ShouldAllowInstallPredicate filter = |
521 (type == syncer::APPS) ? extensions::sync_helper::IsSyncableApp : | 521 (type == syncer::APPS) ? extensions::sync_helper::IsSyncableApp : |
522 extensions::sync_helper::IsSyncableExtension; | 522 extensions::sync_helper::IsSyncableExtension; |
523 | 523 |
524 if (!extension_service_->pending_extension_manager()->AddFromSync( | 524 if (!extension_service_->pending_extension_manager()->AddFromSync( |
525 id, | 525 id, |
526 extension_sync_data.update_url(), | 526 extension_sync_data.update_url(), |
527 filter, | 527 filter, |
528 kInstallSilently, | 528 kInstallSilently, |
529 extension_sync_data.remote_install())) { | 529 extension_sync_data.remote_install(), |
| 530 extension_sync_data.installed_by_custodian())) { |
530 LOG(WARNING) << "Could not add pending extension for " << id; | 531 LOG(WARNING) << "Could not add pending extension for " << id; |
531 // This means that the extension is already pending installation, with a | 532 // This means that the extension is already pending installation, with a |
532 // non-INTERNAL location. Add to pending_sync_data, even though it will | 533 // non-INTERNAL location. Add to pending_sync_data, even though it will |
533 // never be removed (we'll never install a syncable version of the | 534 // never be removed (we'll never install a syncable version of the |
534 // extension), so that GetAllSyncData() continues to send it. | 535 // extension), so that GetAllSyncData() continues to send it. |
535 } | 536 } |
536 // Track pending extensions so that we can return them in GetAllSyncData(). | 537 // Track pending extensions so that we can return them in GetAllSyncData(). |
537 return false; | 538 return false; |
538 } | 539 } |
539 | 540 |
540 return true; | 541 return true; |
541 } | 542 } |
542 | 543 |
543 void ExtensionSyncService::SyncExtensionChangeIfNeeded( | 544 void ExtensionSyncService::SyncExtensionChangeIfNeeded( |
544 const Extension& extension) { | 545 const Extension& extension) { |
545 if (extensions::util::ShouldSyncApp(&extension, profile_)) { | 546 if (extensions::util::ShouldSyncApp(&extension, profile_)) { |
546 if (app_sync_bundle_.IsSyncing()) | 547 if (app_sync_bundle_.IsSyncing()) |
547 app_sync_bundle_.SyncChangeIfNeeded(extension); | 548 app_sync_bundle_.SyncChangeIfNeeded(extension); |
548 else if (extension_service_->is_ready() && !flare_.is_null()) | 549 else if (extension_service_->is_ready() && !flare_.is_null()) |
549 flare_.Run(syncer::APPS); | 550 flare_.Run(syncer::APPS); |
550 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { | 551 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { |
551 if (extension_sync_bundle_.IsSyncing()) | 552 if (extension_sync_bundle_.IsSyncing()) |
552 extension_sync_bundle_.SyncChangeIfNeeded(extension); | 553 extension_sync_bundle_.SyncChangeIfNeeded(extension); |
553 else if (extension_service_->is_ready() && !flare_.is_null()) | 554 else if (extension_service_->is_ready() && !flare_.is_null()) |
554 flare_.Run(syncer::EXTENSIONS); | 555 flare_.Run(syncer::EXTENSIONS); |
555 } | 556 } |
556 } | 557 } |
OLD | NEW |