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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 blacklisted.insert(extension_id); | 187 blacklisted.insert(extension_id); |
188 UpdateBlacklistedExtensions(blacklisted, unchanged); | 188 UpdateBlacklistedExtensions(blacklisted, unchanged); |
189 } | 189 } |
190 | 190 |
191 bool ExtensionService::OnExternalExtensionUpdateUrlFound( | 191 bool ExtensionService::OnExternalExtensionUpdateUrlFound( |
192 const std::string& id, | 192 const std::string& id, |
193 const std::string& install_parameter, | 193 const std::string& install_parameter, |
194 const GURL& update_url, | 194 const GURL& update_url, |
195 Manifest::Location location, | 195 Manifest::Location location, |
196 int creation_flags, | 196 int creation_flags, |
197 bool mark_acknowledged) { | 197 bool mark_acknowledged, |
198 bool is_initial_load) { | |
198 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 199 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
199 CHECK(crx_file::id_util::IdIsValid(id)); | 200 CHECK(crx_file::id_util::IdIsValid(id)); |
200 | 201 |
201 if (Manifest::IsExternalLocation(location)) { | 202 if (Manifest::IsExternalLocation(location)) { |
202 // All extensions that are not user specific can be cached. | 203 // All extensions that are not user specific can be cached. |
203 extensions::ExtensionsBrowserClient::Get()->GetExtensionCache() | 204 extensions::ExtensionsBrowserClient::Get()->GetExtensionCache() |
204 ->AllowCaching(id); | 205 ->AllowCaching(id); |
205 } | 206 } |
206 | 207 |
207 const Extension* extension = GetExtensionById(id, true); | 208 const Extension* extension = GetExtensionById(id, true); |
(...skipping 13 matching lines...) Expand all Loading... | |
221 if (!pending_extension_manager()->AddFromExternalUpdateUrl( | 222 if (!pending_extension_manager()->AddFromExternalUpdateUrl( |
222 id, | 223 id, |
223 install_parameter, | 224 install_parameter, |
224 update_url, | 225 update_url, |
225 location, | 226 location, |
226 creation_flags, | 227 creation_flags, |
227 mark_acknowledged)) { | 228 mark_acknowledged)) { |
228 return false; | 229 return false; |
229 } | 230 } |
230 | 231 |
231 update_once_all_providers_are_ready_ = true; | 232 if (is_initial_load) |
233 update_once_all_providers_are_ready_ = true; | |
232 return true; | 234 return true; |
233 } | 235 } |
234 | 236 |
237 void ExtensionService::OnExternalProviderUpdateComplete( | |
238 const extensions::ExternalProviderInterface* provider, | |
239 const std::set<std::string>& removed_extensions) { | |
240 if (updater_) { | |
241 // Empty params will cause pending extensions to be updated. | |
242 extensions::ExtensionUpdater::CheckParams empty_params; | |
243 updater_->CheckNow(empty_params); | |
asargent_no_longer_on_chrome
2016/01/20 22:49:00
It seems a little unfortunate to kick off an updat
lazyboy
2016/01/21 21:02:12
This should not kick off update check for all curr
| |
244 } | |
245 | |
246 for (const std::string& id : removed_extensions) | |
247 CheckExternalUninstall(id); | |
248 | |
249 error_controller_->ShowErrorIfNeeded(); | |
250 external_install_manager_->UpdateExternalExtensionAlert(); | |
251 } | |
252 | |
235 // static | 253 // static |
236 // This function is used to uninstall an extension via sync. The LOG statements | 254 // This function is used to uninstall an extension via sync. The LOG statements |
237 // within this function are used to inform the user if the uninstall cannot be | 255 // within this function are used to inform the user if the uninstall cannot be |
238 // done. | 256 // done. |
239 bool ExtensionService::UninstallExtensionHelper( | 257 bool ExtensionService::UninstallExtensionHelper( |
240 ExtensionService* extensions_service, | 258 ExtensionService* extensions_service, |
241 const std::string& extension_id, | 259 const std::string& extension_id, |
242 extensions::UninstallReason reason) { | 260 extensions::UninstallReason reason) { |
243 // We can't call UninstallExtension with an invalid extension ID. | 261 // We can't call UninstallExtension with an invalid extension ID. |
244 if (!extensions_service->GetInstalledExtension(extension_id)) { | 262 if (!extensions_service->GetInstalledExtension(extension_id)) { |
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2465 } | 2483 } |
2466 | 2484 |
2467 void ExtensionService::OnProfileDestructionStarted() { | 2485 void ExtensionService::OnProfileDestructionStarted() { |
2468 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2486 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2469 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2487 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2470 it != ids_to_unload.end(); | 2488 it != ids_to_unload.end(); |
2471 ++it) { | 2489 ++it) { |
2472 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2490 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2473 } | 2491 } |
2474 } | 2492 } |
OLD | NEW |