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 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 const std::string& id) const { | 2100 const std::string& id) const { |
2101 return registry_->GetExtensionById(id, ExtensionRegistry::EVERYTHING); | 2101 return registry_->GetExtensionById(id, ExtensionRegistry::EVERYTHING); |
2102 } | 2102 } |
2103 | 2103 |
2104 bool ExtensionService::OnExternalExtensionFileFound( | 2104 bool ExtensionService::OnExternalExtensionFileFound( |
2105 const std::string& id, | 2105 const std::string& id, |
2106 const Version* version, | 2106 const Version* version, |
2107 const base::FilePath& path, | 2107 const base::FilePath& path, |
2108 Manifest::Location location, | 2108 Manifest::Location location, |
2109 int creation_flags, | 2109 int creation_flags, |
2110 bool mark_acknowledged) { | 2110 bool mark_acknowledged, |
| 2111 bool install_immediately) { |
2111 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2112 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2112 CHECK(crx_file::id_util::IdIsValid(id)); | 2113 CHECK(crx_file::id_util::IdIsValid(id)); |
2113 if (extension_prefs_->IsExternalExtensionUninstalled(id)) | 2114 if (extension_prefs_->IsExternalExtensionUninstalled(id)) |
2114 return false; | 2115 return false; |
2115 | 2116 |
2116 // Before even bothering to unpack, check and see if we already have this | 2117 // Before even bothering to unpack, check and see if we already have this |
2117 // version. This is important because these extensions are going to get | 2118 // version. This is important because these extensions are going to get |
2118 // installed on every startup. | 2119 // installed on every startup. |
2119 const Extension* existing = GetExtensionById(id, true); | 2120 const Extension* existing = GetExtensionById(id, true); |
2120 | 2121 |
(...skipping 30 matching lines...) Expand all Loading... |
2151 id, location, *version, creation_flags, mark_acknowledged)) { | 2152 id, location, *version, creation_flags, mark_acknowledged)) { |
2152 return false; | 2153 return false; |
2153 } | 2154 } |
2154 | 2155 |
2155 // no client (silent install) | 2156 // no client (silent install) |
2156 scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); | 2157 scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); |
2157 installer->set_install_source(location); | 2158 installer->set_install_source(location); |
2158 installer->set_expected_id(id); | 2159 installer->set_expected_id(id); |
2159 installer->set_expected_version(*version); | 2160 installer->set_expected_version(*version); |
2160 installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE); | 2161 installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE); |
| 2162 installer->set_install_immediately(install_immediately); |
2161 installer->set_creation_flags(creation_flags); | 2163 installer->set_creation_flags(creation_flags); |
2162 #if defined(OS_CHROMEOS) | 2164 #if defined(OS_CHROMEOS) |
2163 extensions::InstallLimiter::Get(profile_)->Add(installer, path); | 2165 extensions::InstallLimiter::Get(profile_)->Add(installer, path); |
2164 #else | 2166 #else |
2165 installer->InstallCrx(path); | 2167 installer->InstallCrx(path); |
2166 #endif | 2168 #endif |
2167 | 2169 |
2168 // Depending on the source, a new external extension might not need a user | 2170 // Depending on the source, a new external extension might not need a user |
2169 // notification on installation. For such extensions, mark them acknowledged | 2171 // notification on installation. For such extensions, mark them acknowledged |
2170 // now to suppress the notification. | 2172 // now to suppress the notification. |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 } | 2557 } |
2556 | 2558 |
2557 void ExtensionService::OnProfileDestructionStarted() { | 2559 void ExtensionService::OnProfileDestructionStarted() { |
2558 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2560 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2559 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2561 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2560 it != ids_to_unload.end(); | 2562 it != ids_to_unload.end(); |
2561 ++it) { | 2563 ++it) { |
2562 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2564 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2563 } | 2565 } |
2564 } | 2566 } |
OLD | NEW |