OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } else { | 620 } else { |
621 // Otherwise, the extension is unpacked (location LOAD). | 621 // Otherwise, the extension is unpacked (location LOAD). |
622 // We should always be able to remember the extension's path. If it's not in | 622 // We should always be able to remember the extension's path. If it's not in |
623 // the map, someone failed to update |unloaded_extension_paths_|. | 623 // the map, someone failed to update |unloaded_extension_paths_|. |
624 CHECK(!path.empty()); | 624 CHECK(!path.empty()); |
625 extensions::UnpackedInstaller::Create(this)->Load(path); | 625 extensions::UnpackedInstaller::Create(this)->Load(path); |
626 } | 626 } |
627 } | 627 } |
628 | 628 |
629 bool ExtensionService::UninstallExtension( | 629 bool ExtensionService::UninstallExtension( |
630 const std::string& extension_id_unsafe, | 630 std::string extension_id, |
631 bool external_uninstall, | 631 bool external_uninstall, |
632 std::string* error) { | 632 std::string* error) { |
633 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 633 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
634 | 634 |
635 // Copy the extension identifier since the reference might have been | |
636 // obtained via Extension::id() and the extension may be deleted in | |
637 // this function. | |
638 std::string extension_id(extension_id_unsafe); | |
639 | |
640 scoped_refptr<const Extension> extension(GetInstalledExtension(extension_id)); | 635 scoped_refptr<const Extension> extension(GetInstalledExtension(extension_id)); |
641 | 636 |
642 // Callers should not send us nonexistent extensions. | 637 // Callers should not send us nonexistent extensions. |
643 CHECK(extension); | 638 CHECK(extension); |
644 | 639 |
645 // Policy change which triggers an uninstall will always set | 640 // Policy change which triggers an uninstall will always set |
646 // |external_uninstall| to true so this is the only way to uninstall | 641 // |external_uninstall| to true so this is the only way to uninstall |
647 // managed extensions. | 642 // managed extensions. |
648 if (!Extension::UserMayDisable(extension->location()) && | 643 if (!Extension::UserMayDisable(extension->location()) && |
649 !external_uninstall) { | 644 !external_uninstall) { |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 | 2485 |
2491 ExtensionService::NaClModuleInfoList::iterator | 2486 ExtensionService::NaClModuleInfoList::iterator |
2492 ExtensionService::FindNaClModule(const GURL& url) { | 2487 ExtensionService::FindNaClModule(const GURL& url) { |
2493 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2488 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
2494 iter != nacl_module_list_.end(); ++iter) { | 2489 iter != nacl_module_list_.end(); ++iter) { |
2495 if (iter->url == url) | 2490 if (iter->url == url) |
2496 return iter; | 2491 return iter; |
2497 } | 2492 } |
2498 return nacl_module_list_.end(); | 2493 return nacl_module_list_.end(); |
2499 } | 2494 } |
OLD | NEW |