| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 568 } |
| 569 | 569 |
| 570 void ExtensionService::VerifyAllExtensions() { | 570 void ExtensionService::VerifyAllExtensions() { |
| 571 ExtensionIdSet to_add; | 571 ExtensionIdSet to_add; |
| 572 scoped_ptr<ExtensionSet> all_extensions = GenerateInstalledExtensionsSet(); | 572 scoped_ptr<ExtensionSet> all_extensions = GenerateInstalledExtensionsSet(); |
| 573 | 573 |
| 574 for (ExtensionSet::const_iterator i = all_extensions->begin(); | 574 for (ExtensionSet::const_iterator i = all_extensions->begin(); |
| 575 i != all_extensions->end(); ++i) { | 575 i != all_extensions->end(); ++i) { |
| 576 const Extension& extension = **i; | 576 const Extension& extension = **i; |
| 577 | 577 |
| 578 if (extensions::ManifestURL::UpdatesFromGallery(&extension) && | 578 if (InstallVerifier::NeedsVerification(extension)) |
| 579 extension.is_extension()) | |
| 580 to_add.insert(extension.id()); | 579 to_add.insert(extension.id()); |
| 581 } | 580 } |
| 582 extensions::ExtensionSystem::Get(profile_)->install_verifier()->AddMany( | 581 extensions::ExtensionSystem::Get(profile_)->install_verifier()->AddMany( |
| 583 to_add, base::Bind(&ExtensionService::FinishVerifyAllExtensions, | 582 to_add, base::Bind(&ExtensionService::FinishVerifyAllExtensions, |
| 584 AsWeakPtr())); | 583 AsWeakPtr())); |
| 585 } | 584 } |
| 586 | 585 |
| 587 void ExtensionService::FinishVerifyAllExtensions(bool success) { | 586 void ExtensionService::FinishVerifyAllExtensions(bool success) { |
| 588 if (success) { | 587 if (success) { |
| 589 // Check to see if any currently unverified extensions became verified. | 588 // Check to see if any currently unverified extensions became verified. |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 extensions::BlacklistState blacklist_state, | 2184 extensions::BlacklistState blacklist_state, |
| 2186 const syncer::StringOrdinal& page_ordinal) { | 2185 const syncer::StringOrdinal& page_ordinal) { |
| 2187 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2186 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2188 const bool blacklisted_for_malware = | 2187 const bool blacklisted_for_malware = |
| 2189 blacklist_state == extensions::BLACKLISTED_MALWARE; | 2188 blacklist_state == extensions::BLACKLISTED_MALWARE; |
| 2190 extension_prefs_->OnExtensionInstalled(extension, | 2189 extension_prefs_->OnExtensionInstalled(extension, |
| 2191 initial_state, | 2190 initial_state, |
| 2192 blacklisted_for_malware, | 2191 blacklisted_for_malware, |
| 2193 page_ordinal); | 2192 page_ordinal); |
| 2194 delayed_installs_.Remove(extension->id()); | 2193 delayed_installs_.Remove(extension->id()); |
| 2195 if (extensions::ManifestURL::UpdatesFromGallery(extension)) { | 2194 if (InstallVerifier::NeedsVerification(*extension)) { |
| 2196 extensions::ExtensionSystem::Get(profile_)->install_verifier()->Add( | 2195 extensions::ExtensionSystem::Get(profile_)->install_verifier()->Add( |
| 2197 extension->id(), InstallVerifier::AddResultCallback()); | 2196 extension->id(), InstallVerifier::AddResultCallback()); |
| 2198 } | 2197 } |
| 2199 FinishInstallation(extension); | 2198 FinishInstallation(extension); |
| 2200 } | 2199 } |
| 2201 | 2200 |
| 2202 void ExtensionService::MaybeFinishDelayedInstallation( | 2201 void ExtensionService::MaybeFinishDelayedInstallation( |
| 2203 const std::string& extension_id) { | 2202 const std::string& extension_id) { |
| 2204 // Check if the extension already got installed. | 2203 // Check if the extension already got installed. |
| 2205 if (!delayed_installs_.Contains(extension_id)) | 2204 if (!delayed_installs_.Contains(extension_id)) |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 void ExtensionService::UnloadAllExtensionsInternal() { | 2814 void ExtensionService::UnloadAllExtensionsInternal() { |
| 2816 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2815 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
| 2817 | 2816 |
| 2818 registry_->ClearAll(); | 2817 registry_->ClearAll(); |
| 2819 extension_runtime_data_.clear(); | 2818 extension_runtime_data_.clear(); |
| 2820 | 2819 |
| 2821 // TODO(erikkay) should there be a notification for this? We can't use | 2820 // TODO(erikkay) should there be a notification for this? We can't use |
| 2822 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 2821 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
| 2823 // or uninstalled. | 2822 // or uninstalled. |
| 2824 } | 2823 } |
| OLD | NEW |