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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 const Extension* extension = extension_service_->GetInstalledExtension(id); | 437 const Extension* extension = extension_service_->GetInstalledExtension(id); |
438 | 438 |
439 // TODO(bolms): we should really handle this better. The particularly bad | 439 // TODO(bolms): we should really handle this better. The particularly bad |
440 // case is where an app becomes an extension or vice versa, and we end up with | 440 // case is where an app becomes an extension or vice versa, and we end up with |
441 // a zombie extension that won't go away. | 441 // a zombie extension that won't go away. |
442 if (extension && !IsCorrectSyncType(*extension, type)) | 442 if (extension && !IsCorrectSyncType(*extension, type)) |
443 return true; | 443 return true; |
444 | 444 |
445 // Handle uninstalls first. | 445 // Handle uninstalls first. |
446 if (extension_sync_data.uninstalled()) { | 446 if (extension_sync_data.uninstalled()) { |
447 if (!extension_service_->UninstallExtensionHelper(extension_service_, id)) { | 447 if (!extension_service_->UninstallExtensionHelper( |
| 448 extension_service_, |
| 449 id, |
| 450 ExtensionService::kUninstallReasonSynch)) { |
448 LOG(WARNING) << "Could not uninstall extension " << id | 451 LOG(WARNING) << "Could not uninstall extension " << id |
449 << " for sync"; | 452 << " for sync"; |
450 } | 453 } |
451 return true; | 454 return true; |
452 } | 455 } |
453 | 456 |
454 // Extension from sync was uninstalled by the user as external extensions. | 457 // Extension from sync was uninstalled by the user as external extensions. |
455 // Honor user choice and skip installation/enabling. | 458 // Honor user choice and skip installation/enabling. |
456 if (extensions::ExtensionPrefs::Get(profile_) | 459 if (extensions::ExtensionPrefs::Get(profile_) |
457 ->IsExternalExtensionUninstalled(id)) { | 460 ->IsExternalExtensionUninstalled(id)) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 app_sync_bundle_.SyncChangeIfNeeded(extension); | 525 app_sync_bundle_.SyncChangeIfNeeded(extension); |
523 else if (extension_service_->is_ready() && !flare_.is_null()) | 526 else if (extension_service_->is_ready() && !flare_.is_null()) |
524 flare_.Run(syncer::APPS); | 527 flare_.Run(syncer::APPS); |
525 } else if (extensions::sync_helper::IsSyncableExtension(&extension)) { | 528 } else if (extensions::sync_helper::IsSyncableExtension(&extension)) { |
526 if (extension_sync_bundle_.IsSyncing()) | 529 if (extension_sync_bundle_.IsSyncing()) |
527 extension_sync_bundle_.SyncChangeIfNeeded(extension); | 530 extension_sync_bundle_.SyncChangeIfNeeded(extension); |
528 else if (extension_service_->is_ready() && !flare_.is_null()) | 531 else if (extension_service_->is_ready() && !flare_.is_null()) |
529 flare_.Run(syncer::EXTENSIONS); | 532 flare_.Run(syncer::EXTENSIONS); |
530 } | 533 } |
531 } | 534 } |
OLD | NEW |