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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/bookmark_app_helper.h" | 10 #include "chrome/browser/extensions/bookmark_app_helper.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 } else if (!should_be_enabled) { | 432 } else if (!should_be_enabled) { |
433 // Note that |disable_reasons| includes any pre-existing reasons that | 433 // Note that |disable_reasons| includes any pre-existing reasons that |
434 // weren't explicitly removed above. | 434 // weren't explicitly removed above. |
435 if (extension_service()->IsExtensionEnabled(id)) | 435 if (extension_service()->IsExtensionEnabled(id)) |
436 extension_service()->DisableExtension(id, disable_reasons); | 436 extension_service()->DisableExtension(id, disable_reasons); |
437 else // Already disabled, just replace the disable reasons. | 437 else // Already disabled, just replace the disable reasons. |
438 extension_prefs->ReplaceDisableReasons(id, disable_reasons); | 438 extension_prefs->ReplaceDisableReasons(id, disable_reasons); |
439 } | 439 } |
440 | 440 |
441 // If the target extension has already been installed ephemerally, it can | |
442 // be promoted to a regular installed extension and downloading from the Web | |
443 // Store is not necessary. | |
444 if (extension && extensions::util::IsEphemeralApp(id, profile_)) | |
445 extension_service()->PromoteEphemeralApp(extension, true); | |
446 | |
447 // Update the incognito flag. | 441 // Update the incognito flag. |
448 extensions::util::SetIsIncognitoEnabled( | 442 extensions::util::SetIsIncognitoEnabled( |
449 id, profile_, extension_sync_data.incognito_enabled()); | 443 id, profile_, extension_sync_data.incognito_enabled()); |
450 extension = nullptr; // No longer safe to use. | 444 extension = nullptr; // No longer safe to use. |
451 | 445 |
452 // Update the all urls flag. | 446 // Update the all urls flag. |
453 if (extension_sync_data.all_urls_enabled() != | 447 if (extension_sync_data.all_urls_enabled() != |
454 ExtensionSyncData::BOOLEAN_UNSET) { | 448 ExtensionSyncData::BOOLEAN_UNSET) { |
455 bool allowed = extension_sync_data.all_urls_enabled() == | 449 bool allowed = extension_sync_data.all_urls_enabled() == |
456 ExtensionSyncData::BOOLEAN_TRUE; | 450 ExtensionSyncData::BOOLEAN_TRUE; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 if (IsCorrectSyncType(*extension, type) && | 677 if (IsCorrectSyncType(*extension, type) && |
684 extensions::util::ShouldSync(extension.get(), profile_) && | 678 extensions::util::ShouldSync(extension.get(), profile_) && |
685 (include_everything || | 679 (include_everything || |
686 ExtensionPrefs::Get(profile_)->NeedsSync(extension->id()))) { | 680 ExtensionPrefs::Get(profile_)->NeedsSync(extension->id()))) { |
687 // We should never have pending data for an installed extension. | 681 // We should never have pending data for an installed extension. |
688 DCHECK(!GetSyncBundle(type)->HasPendingExtensionData(extension->id())); | 682 DCHECK(!GetSyncBundle(type)->HasPendingExtensionData(extension->id())); |
689 sync_data_list->push_back(CreateSyncData(*extension)); | 683 sync_data_list->push_back(CreateSyncData(*extension)); |
690 } | 684 } |
691 } | 685 } |
692 } | 686 } |
OLD | NEW |