Chromium Code Reviews| 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 } | 660 } |
| 661 | 661 |
| 662 const ExtensionList* ExtensionService::disabled_extensions() const { | 662 const ExtensionList* ExtensionService::disabled_extensions() const { |
| 663 return &disabled_extensions_; | 663 return &disabled_extensions_; |
| 664 } | 664 } |
| 665 | 665 |
| 666 const ExtensionList* ExtensionService::terminated_extensions() const { | 666 const ExtensionList* ExtensionService::terminated_extensions() const { |
| 667 return &terminated_extensions_; | 667 return &terminated_extensions_; |
| 668 } | 668 } |
| 669 | 669 |
| 670 void ExtensionService::SetDelaysNetworkRequests(const Extension* extension, | |
| 671 bool delays) { | |
| 672 extension_prefs_->SetDelaysNetworkRequests(extension->id(), delays); | |
| 673 } | |
| 674 | |
| 675 bool ExtensionService::DelaysNetworkRequests(const Extension* extension) const { | |
| 676 return extension_prefs_->DelaysNetworkRequests(extension->id()); | |
| 677 } | |
| 678 | |
| 670 PendingExtensionManager* ExtensionService::pending_extension_manager() { | 679 PendingExtensionManager* ExtensionService::pending_extension_manager() { |
| 671 return &pending_extension_manager_; | 680 return &pending_extension_manager_; |
| 672 } | 681 } |
| 673 | 682 |
| 674 void ExtensionService::UnregisterComponentExtension( | 683 void ExtensionService::UnregisterComponentExtension( |
| 675 const ComponentExtensionInfo& info) { | 684 const ComponentExtensionInfo& info) { |
| 676 RegisteredComponentExtensions new_component_extension_manifests; | 685 RegisteredComponentExtensions new_component_extension_manifests; |
| 677 for (RegisteredComponentExtensions::iterator it = | 686 for (RegisteredComponentExtensions::iterator it = |
| 678 component_extension_manifests_.begin(); | 687 component_extension_manifests_.begin(); |
| 679 it != component_extension_manifests_.end(); ++it) { | 688 it != component_extension_manifests_.end(); ++it) { |
| (...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2494 from_webstore, | 2503 from_webstore, |
| 2495 page_index); | 2504 page_index); |
| 2496 | 2505 |
| 2497 // Unpacked extensions default to allowing file access, but if that has been | 2506 // Unpacked extensions default to allowing file access, but if that has been |
| 2498 // overridden, don't reset the value. | 2507 // overridden, don't reset the value. |
| 2499 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && | 2508 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |
| 2500 !extension_prefs_->HasAllowFileAccessSetting(id)) { | 2509 !extension_prefs_->HasAllowFileAccessSetting(id)) { |
| 2501 extension_prefs_->SetAllowFileAccess(id, true); | 2510 extension_prefs_->SetAllowFileAccess(id, true); |
| 2502 } | 2511 } |
| 2503 | 2512 |
| 2513 // If the extension should automatically block network startup (e.g., it uses | |
| 2514 // the webRequest API), set the preference. Otherwise clear it, in case the | |
| 2515 // extension stopped using a relevant API. | |
| 2516 SetDelaysNetworkRequests(extension, | |
|
Aaron Boodman
2011/10/10 22:59:29
This will definitely clear (as in remove from the
Pam (message me for reviews)
2011/10/12 14:28:12
Yes, if false it removes the pref from the Extensi
| |
| 2517 extension->ImplicitlyDelaysNetworkStartup()); | |
| 2518 | |
| 2504 NotificationService::current()->Notify( | 2519 NotificationService::current()->Notify( |
| 2505 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 2520 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 2506 Source<Profile>(profile_), | 2521 Source<Profile>(profile_), |
| 2507 Details<const Extension>(extension)); | 2522 Details<const Extension>(extension)); |
| 2508 | 2523 |
| 2509 // Transfer ownership of |extension| to AddExtension. | 2524 // Transfer ownership of |extension| to AddExtension. |
| 2510 AddExtension(scoped_extension); | 2525 AddExtension(scoped_extension); |
| 2511 } | 2526 } |
| 2512 | 2527 |
| 2513 const Extension* ExtensionService::GetExtensionByIdInternal( | 2528 const Extension* ExtensionService::GetExtensionByIdInternal( |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2894 | 2909 |
| 2895 ExtensionService::NaClModuleInfoList::iterator | 2910 ExtensionService::NaClModuleInfoList::iterator |
| 2896 ExtensionService::FindNaClModule(const GURL& url) { | 2911 ExtensionService::FindNaClModule(const GURL& url) { |
| 2897 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2912 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2898 iter != nacl_module_list_.end(); ++iter) { | 2913 iter != nacl_module_list_.end(); ++iter) { |
| 2899 if (iter->url == url) | 2914 if (iter->url == url) |
| 2900 return iter; | 2915 return iter; |
| 2901 } | 2916 } |
| 2902 return nacl_module_list_.end(); | 2917 return nacl_module_list_.end(); |
| 2903 } | 2918 } |
| OLD | NEW |