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