| 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(extension_service_, id)) { | 452 if (!extension_service_->UninstallExtensionHelper( |
| 453 extension_service_, id, ExtensionService::UNINSTALL_REASON_SYNC)) { |
| 453 LOG(WARNING) << "Could not uninstall extension " << id | 454 LOG(WARNING) << "Could not uninstall extension " << id |
| 454 << " for sync"; | 455 << " for sync"; |
| 455 } | 456 } |
| 456 return true; | 457 return true; |
| 457 } | 458 } |
| 458 | 459 |
| 459 // Extension from sync was uninstalled by the user as external extensions. | 460 // Extension from sync was uninstalled by the user as external extensions. |
| 460 // Honor user choice and skip installation/enabling. | 461 // Honor user choice and skip installation/enabling. |
| 461 if (extensions::ExtensionPrefs::Get(profile_) | 462 if (extensions::ExtensionPrefs::Get(profile_) |
| 462 ->IsExternalExtensionUninstalled(id)) { | 463 ->IsExternalExtensionUninstalled(id)) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |