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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/sync/glue/sync_start_util.h" | 21 #include "chrome/browser/sync/glue/sync_start_util.h" |
22 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
23 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 23 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
24 #include "chrome/common/extensions/sync_helper.h" | 24 #include "chrome/common/extensions/sync_helper.h" |
25 #include "chrome/common/web_application_info.h" | 25 #include "chrome/common/web_application_info.h" |
26 #include "components/sync_driver/sync_prefs.h" | 26 #include "components/sync_driver/sync_prefs.h" |
27 #include "extensions/browser/app_sorting.h" | 27 #include "extensions/browser/app_sorting.h" |
28 #include "extensions/browser/extension_prefs.h" | 28 #include "extensions/browser/extension_prefs.h" |
29 #include "extensions/browser/extension_registry.h" | 29 #include "extensions/browser/extension_registry.h" |
30 #include "extensions/browser/extension_util.h" | 30 #include "extensions/browser/extension_util.h" |
| 31 #include "extensions/browser/uninstall_reason.h" |
31 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
32 #include "extensions/common/extension_icon_set.h" | 33 #include "extensions/common/extension_icon_set.h" |
33 #include "extensions/common/feature_switch.h" | 34 #include "extensions/common/feature_switch.h" |
34 #include "extensions/common/manifest_constants.h" | 35 #include "extensions/common/manifest_constants.h" |
35 #include "extensions/common/manifest_handlers/icons_handler.h" | 36 #include "extensions/common/manifest_handlers/icons_handler.h" |
36 #include "sync/api/sync_change.h" | 37 #include "sync/api/sync_change.h" |
37 #include "sync/api/sync_error_factory.h" | 38 #include "sync/api/sync_error_factory.h" |
38 #include "ui/gfx/image/image_family.h" | 39 #include "ui/gfx/image/image_family.h" |
39 | 40 |
40 using extensions::Extension; | 41 using extensions::Extension; |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 | 444 |
444 // TODO(bolms): we should really handle this better. The particularly bad | 445 // 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 | 446 // 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. | 447 // a zombie extension that won't go away. |
447 if (extension && !IsCorrectSyncType(*extension, type)) | 448 if (extension && !IsCorrectSyncType(*extension, type)) |
448 return true; | 449 return true; |
449 | 450 |
450 // Handle uninstalls first. | 451 // Handle uninstalls first. |
451 if (extension_sync_data.uninstalled()) { | 452 if (extension_sync_data.uninstalled()) { |
452 if (!extension_service_->UninstallExtensionHelper( | 453 if (!extension_service_->UninstallExtensionHelper( |
453 extension_service_, id, ExtensionService::UNINSTALL_REASON_SYNC)) { | 454 extension_service_, id, extensions::UNINSTALL_REASON_SYNC)) { |
454 LOG(WARNING) << "Could not uninstall extension " << id | 455 LOG(WARNING) << "Could not uninstall extension " << id |
455 << " for sync"; | 456 << " for sync"; |
456 } | 457 } |
457 return true; | 458 return true; |
458 } | 459 } |
459 | 460 |
460 // Extension from sync was uninstalled by the user as external extensions. | 461 // Extension from sync was uninstalled by the user as external extensions. |
461 // Honor user choice and skip installation/enabling. | 462 // Honor user choice and skip installation/enabling. |
462 if (extensions::ExtensionPrefs::Get(profile_) | 463 if (extensions::ExtensionPrefs::Get(profile_) |
463 ->IsExternalExtensionUninstalled(id)) { | 464 ->IsExternalExtensionUninstalled(id)) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 app_sync_bundle_.SyncChangeIfNeeded(extension); | 549 app_sync_bundle_.SyncChangeIfNeeded(extension); |
549 else if (extension_service_->is_ready() && !flare_.is_null()) | 550 else if (extension_service_->is_ready() && !flare_.is_null()) |
550 flare_.Run(syncer::APPS); | 551 flare_.Run(syncer::APPS); |
551 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { | 552 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { |
552 if (extension_sync_bundle_.IsSyncing()) | 553 if (extension_sync_bundle_.IsSyncing()) |
553 extension_sync_bundle_.SyncChangeIfNeeded(extension); | 554 extension_sync_bundle_.SyncChangeIfNeeded(extension); |
554 else if (extension_service_->is_ready() && !flare_.is_null()) | 555 else if (extension_service_->is_ready() && !flare_.is_null()) |
555 flare_.Run(syncer::EXTENSIONS); | 556 flare_.Run(syncer::EXTENSIONS); |
556 } | 557 } |
557 } | 558 } |
OLD | NEW |