| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 735 |
| 736 syncer::SyncChange sync_change; | 736 syncer::SyncChange sync_change; |
| 737 // Don't sync the uninstall if we're going to reinstall the extension | 737 // Don't sync the uninstall if we're going to reinstall the extension |
| 738 // momentarily. | 738 // momentarily. |
| 739 if (extension_sync_service_ && | 739 if (extension_sync_service_ && |
| 740 reason != extensions::UNINSTALL_REASON_REINSTALL) { | 740 reason != extensions::UNINSTALL_REASON_REINSTALL) { |
| 741 sync_change = extension_sync_service_->PrepareToSyncUninstallExtension( | 741 sync_change = extension_sync_service_->PrepareToSyncUninstallExtension( |
| 742 extension.get(), is_ready()); | 742 extension.get(), is_ready()); |
| 743 } | 743 } |
| 744 | 744 |
| 745 system_->install_verifier()->Remove(extension->id()); | 745 InstallVerifier::Get(GetBrowserContext())->Remove(extension->id()); |
| 746 | 746 |
| 747 UMA_HISTOGRAM_ENUMERATION("Extensions.UninstallType", | 747 UMA_HISTOGRAM_ENUMERATION("Extensions.UninstallType", |
| 748 extension->GetType(), 100); | 748 extension->GetType(), 100); |
| 749 RecordPermissionMessagesHistogram(extension.get(), "Uninstall"); | 749 RecordPermissionMessagesHistogram(extension.get(), "Uninstall"); |
| 750 | 750 |
| 751 // Unload before doing more cleanup to ensure that nothing is hanging on to | 751 // Unload before doing more cleanup to ensure that nothing is hanging on to |
| 752 // any of these resources. | 752 // any of these resources. |
| 753 UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UNINSTALL); | 753 UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UNINSTALL); |
| 754 | 754 |
| 755 // Tell the backend to start deleting installed extensions on the file thread. | 755 // Tell the backend to start deleting installed extensions on the file thread. |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 Extension::State initial_state, | 1906 Extension::State initial_state, |
| 1907 int install_flags, | 1907 int install_flags, |
| 1908 const syncer::StringOrdinal& page_ordinal, | 1908 const syncer::StringOrdinal& page_ordinal, |
| 1909 const std::string& install_parameter) { | 1909 const std::string& install_parameter) { |
| 1910 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1910 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1911 bool was_ephemeral = extension_prefs_->IsEphemeralApp(extension->id()); | 1911 bool was_ephemeral = extension_prefs_->IsEphemeralApp(extension->id()); |
| 1912 extension_prefs_->OnExtensionInstalled( | 1912 extension_prefs_->OnExtensionInstalled( |
| 1913 extension, initial_state, page_ordinal, install_flags, install_parameter); | 1913 extension, initial_state, page_ordinal, install_flags, install_parameter); |
| 1914 delayed_installs_.Remove(extension->id()); | 1914 delayed_installs_.Remove(extension->id()); |
| 1915 if (InstallVerifier::NeedsVerification(*extension)) | 1915 if (InstallVerifier::NeedsVerification(*extension)) |
| 1916 system_->install_verifier()->VerifyExtension(extension->id()); | 1916 InstallVerifier::Get(GetBrowserContext())->VerifyExtension(extension->id()); |
| 1917 | 1917 |
| 1918 const Extension* old = GetInstalledExtension(extension->id()); | 1918 const Extension* old = GetInstalledExtension(extension->id()); |
| 1919 if (extensions::AppDataMigrator::NeedsMigration(old, extension)) { | 1919 if (extensions::AppDataMigrator::NeedsMigration(old, extension)) { |
| 1920 app_data_migrator_->DoMigrationAndReply( | 1920 app_data_migrator_->DoMigrationAndReply( |
| 1921 old, extension, | 1921 old, extension, |
| 1922 base::Bind(&ExtensionService::FinishInstallation, AsWeakPtr(), | 1922 base::Bind(&ExtensionService::FinishInstallation, AsWeakPtr(), |
| 1923 make_scoped_refptr(extension), was_ephemeral)); | 1923 make_scoped_refptr(extension), was_ephemeral)); |
| 1924 return; | 1924 return; |
| 1925 } | 1925 } |
| 1926 | 1926 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 } | 2598 } |
| 2599 | 2599 |
| 2600 void ExtensionService::OnProfileDestructionStarted() { | 2600 void ExtensionService::OnProfileDestructionStarted() { |
| 2601 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2601 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2602 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2602 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2603 it != ids_to_unload.end(); | 2603 it != ids_to_unload.end(); |
| 2604 ++it) { | 2604 ++it) { |
| 2605 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2605 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2606 } | 2606 } |
| 2607 } | 2607 } |
| OLD | NEW |