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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 const Extension* extension = extension_service_->GetInstalledExtension(id); | 443 const Extension* extension = extension_service_->GetInstalledExtension(id); |
444 | 444 |
445 // TODO(bolms): we should really handle this better. The particularly bad | 445 // TODO(bolms): we should really handle this better. The particularly bad |
446 // case is where an app becomes an extension or vice versa, and we end up with | 446 // case is where an app becomes an extension or vice versa, and we end up with |
447 // a zombie extension that won't go away. | 447 // a zombie extension that won't go away. |
448 if (extension && !IsCorrectSyncType(*extension, type)) | 448 if (extension && !IsCorrectSyncType(*extension, type)) |
449 return true; | 449 return true; |
450 | 450 |
451 // Handle uninstalls first. | 451 // Handle uninstalls first. |
452 if (extension_sync_data.uninstalled()) { | 452 if (extension_sync_data.uninstalled()) { |
| 453 extensions::UninstallReason reason = |
| 454 extension_sync_data.installed_by_custodian() ? |
| 455 extensions::UNINSTALL_REASON_SYNC_BY_CUSTODIAN : |
| 456 extensions::UNINSTALL_REASON_SYNC; |
453 if (!extension_service_->UninstallExtensionHelper( | 457 if (!extension_service_->UninstallExtensionHelper( |
454 extension_service_, id, extensions::UNINSTALL_REASON_SYNC)) { | 458 extension_service_, id, reason)) { |
455 LOG(WARNING) << "Could not uninstall extension " << id | 459 LOG(WARNING) << "Could not uninstall extension " << id << " for sync"; |
456 << " for sync"; | |
457 } | 460 } |
458 return true; | 461 return true; |
459 } | 462 } |
460 | 463 |
461 // Extension from sync was uninstalled by the user as external extensions. | 464 // Extension from sync was uninstalled by the user as external extensions. |
462 // Honor user choice and skip installation/enabling. | 465 // Honor user choice and skip installation/enabling. |
463 if (extensions::ExtensionPrefs::Get(profile_) | 466 if (extensions::ExtensionPrefs::Get(profile_) |
464 ->IsExternalExtensionUninstalled(id)) { | 467 ->IsExternalExtensionUninstalled(id)) { |
465 LOG(WARNING) << "Extension with id " << id | 468 LOG(WARNING) << "Extension with id " << id |
466 << " from sync was uninstalled as external extension"; | 469 << " from sync was uninstalled as external extension"; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 app_sync_bundle_.SyncChangeIfNeeded(extension); | 552 app_sync_bundle_.SyncChangeIfNeeded(extension); |
550 else if (extension_service_->is_ready() && !flare_.is_null()) | 553 else if (extension_service_->is_ready() && !flare_.is_null()) |
551 flare_.Run(syncer::APPS); | 554 flare_.Run(syncer::APPS); |
552 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { | 555 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { |
553 if (extension_sync_bundle_.IsSyncing()) | 556 if (extension_sync_bundle_.IsSyncing()) |
554 extension_sync_bundle_.SyncChangeIfNeeded(extension); | 557 extension_sync_bundle_.SyncChangeIfNeeded(extension); |
555 else if (extension_service_->is_ready() && !flare_.is_null()) | 558 else if (extension_service_->is_ready() && !flare_.is_null()) |
556 flare_.Run(syncer::EXTENSIONS); | 559 flare_.Run(syncer::EXTENSIONS); |
557 } | 560 } |
558 } | 561 } |
OLD | NEW |