| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 state == extensions::BLACKLISTED_POTENTIALLY_UNWANTED || | 469 state == extensions::BLACKLISTED_POTENTIALLY_UNWANTED || |
| 470 state == extensions::BLACKLISTED_CWS_POLICY_VIOLATION) | 470 state == extensions::BLACKLISTED_CWS_POLICY_VIOLATION) |
| 471 greylist_.Insert(*it); | 471 greylist_.Insert(*it); |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 | 474 |
| 475 bool ExtensionService::UpdateExtension(const std::string& id, | 475 bool ExtensionService::UpdateExtension(const std::string& id, |
| 476 const base::FilePath& extension_path, | 476 const base::FilePath& extension_path, |
| 477 bool file_ownership_passed, | 477 bool file_ownership_passed, |
| 478 CrxInstaller** out_crx_installer) { | 478 CrxInstaller** out_crx_installer) { |
| 479 return ExtensionService::CheckAndUpdateExtension( |
| 480 id, extension_path, std::string(), file_ownership_passed, |
| 481 out_crx_installer); |
| 482 } |
| 483 |
| 484 bool ExtensionService::CheckAndUpdateExtension( |
| 485 const std::string& id, |
| 486 const base::FilePath& extension_path, |
| 487 const std::string& package_hash, |
| 488 bool file_ownership_passed, |
| 489 CrxInstaller** out_crx_installer) { |
| 479 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 490 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 480 if (browser_terminating_) { | 491 if (browser_terminating_) { |
| 481 LOG(WARNING) << "Skipping UpdateExtension due to browser shutdown"; | 492 LOG(WARNING) << "Skipping UpdateExtension due to browser shutdown"; |
| 482 // Leak the temp file at extension_path. We don't want to add to the disk | 493 // Leak the temp file at extension_path. We don't want to add to the disk |
| 483 // I/O burden at shutdown, we can't rely on the I/O completing anyway, and | 494 // I/O burden at shutdown, we can't rely on the I/O completing anyway, and |
| 484 // the file is in the OS temp directory which should be cleaned up for us. | 495 // the file is in the OS temp directory which should be cleaned up for us. |
| 485 return false; | 496 return false; |
| 486 } | 497 } |
| 487 | 498 |
| 488 const extensions::PendingExtensionInfo* pending_extension_info = | 499 const extensions::PendingExtensionInfo* pending_extension_info = |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 559 |
| 549 if (extension) { | 560 if (extension) { |
| 550 installer->set_is_ephemeral(extension_prefs_->IsEphemeralApp(id)); | 561 installer->set_is_ephemeral(extension_prefs_->IsEphemeralApp(id)); |
| 551 installer->set_do_not_sync(extension_prefs_->DoNotSync(id)); | 562 installer->set_do_not_sync(extension_prefs_->DoNotSync(id)); |
| 552 } | 563 } |
| 553 | 564 |
| 554 installer->set_creation_flags(creation_flags); | 565 installer->set_creation_flags(creation_flags); |
| 555 | 566 |
| 556 installer->set_delete_source(file_ownership_passed); | 567 installer->set_delete_source(file_ownership_passed); |
| 557 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); | 568 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); |
| 558 installer->InstallCrx(extension_path); | 569 installer->CheckAndInstallCrx(extension_path, package_hash); |
| 559 | 570 |
| 560 if (out_crx_installer) | 571 if (out_crx_installer) |
| 561 *out_crx_installer = installer.get(); | 572 *out_crx_installer = installer.get(); |
| 562 | 573 |
| 563 return true; | 574 return true; |
| 564 } | 575 } |
| 565 | 576 |
| 566 void ExtensionService::ReloadExtensionImpl( | 577 void ExtensionService::ReloadExtensionImpl( |
| 567 // "transient" because the process of reloading may cause the reference | 578 // "transient" because the process of reloading may cause the reference |
| 568 // to become invalid. Instead, use |extension_id|, a copy. | 579 // to become invalid. Instead, use |extension_id|, a copy. |
| (...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2529 } | 2540 } |
| 2530 | 2541 |
| 2531 void ExtensionService::OnProfileDestructionStarted() { | 2542 void ExtensionService::OnProfileDestructionStarted() { |
| 2532 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2543 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2533 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2544 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2534 it != ids_to_unload.end(); | 2545 it != ids_to_unload.end(); |
| 2535 ++it) { | 2546 ++it) { |
| 2536 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2547 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2537 } | 2548 } |
| 2538 } | 2549 } |
| OLD | NEW |