OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 break; | 2575 break; |
2576 | 2576 |
2577 process_map_.RemoveAllFromProcess(process->GetID()); | 2577 process_map_.RemoveAllFromProcess(process->GetID()); |
2578 BrowserThread::PostTask( | 2578 BrowserThread::PostTask( |
2579 BrowserThread::IO, FROM_HERE, | 2579 BrowserThread::IO, FROM_HERE, |
2580 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, | 2580 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, |
2581 system_->info_map(), | 2581 system_->info_map(), |
2582 process->GetID())); | 2582 process->GetID())); |
2583 break; | 2583 break; |
2584 } | 2584 } |
2585 case chrome::NOTIFICATION_PREF_CHANGED: { | |
2586 const std::string& pref_name = | |
2587 *content::Details<std::string>(details).ptr(); | |
2588 DCHECK(pref_name == prefs::kExtensionInstallAllowList || | |
2589 pref_name == prefs::kExtensionInstallDenyList) | |
2590 << "Unexpected preference name " << pref_name; | |
2591 IdentifyAlertableExtensions(); | |
2592 CheckManagementPolicy(); | |
2593 break; | |
2594 } | |
2595 case chrome::NOTIFICATION_IMPORT_FINISHED: { | 2585 case chrome::NOTIFICATION_IMPORT_FINISHED: { |
2596 InitAfterImport(); | 2586 InitAfterImport(); |
2597 break; | 2587 break; |
2598 } | 2588 } |
2599 | 2589 |
2600 default: | 2590 default: |
2601 NOTREACHED() << "Unexpected notification type."; | 2591 NOTREACHED() << "Unexpected notification type."; |
2602 } | 2592 } |
2603 } | 2593 } |
2604 | 2594 |
| 2595 void ExtensionService::OnPreferenceChanged(PrefServiceBase* service, |
| 2596 const std::string& pref_name) { |
| 2597 DCHECK(pref_name == prefs::kExtensionInstallAllowList || |
| 2598 pref_name == prefs::kExtensionInstallDenyList) |
| 2599 << "Unexpected preference name " << pref_name; |
| 2600 IdentifyAlertableExtensions(); |
| 2601 CheckManagementPolicy(); |
| 2602 } |
| 2603 |
2605 bool ExtensionService::HasApps() const { | 2604 bool ExtensionService::HasApps() const { |
2606 return !GetAppIds().empty(); | 2605 return !GetAppIds().empty(); |
2607 } | 2606 } |
2608 | 2607 |
2609 ExtensionIdSet ExtensionService::GetAppIds() const { | 2608 ExtensionIdSet ExtensionService::GetAppIds() const { |
2610 ExtensionIdSet result; | 2609 ExtensionIdSet result; |
2611 for (ExtensionSet::const_iterator it = extensions_.begin(); | 2610 for (ExtensionSet::const_iterator it = extensions_.begin(); |
2612 it != extensions_.end(); ++it) { | 2611 it != extensions_.end(); ++it) { |
2613 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) | 2612 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) |
2614 result.insert((*it)->id()); | 2613 result.insert((*it)->id()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2825 // External extensions are initially disabled. We prompt the user before | 2824 // External extensions are initially disabled. We prompt the user before |
2826 // enabling them. | 2825 // enabling them. |
2827 if (Extension::IsExternalLocation(extension->location()) && | 2826 if (Extension::IsExternalLocation(extension->location()) && |
2828 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { | 2827 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { |
2829 return false; | 2828 return false; |
2830 } | 2829 } |
2831 } | 2830 } |
2832 | 2831 |
2833 return true; | 2832 return true; |
2834 } | 2833 } |
OLD | NEW |