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