Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 break; 2574 break;
2575 2575
2576 process_map_.RemoveAllFromProcess(process->GetID()); 2576 process_map_.RemoveAllFromProcess(process->GetID());
2577 BrowserThread::PostTask( 2577 BrowserThread::PostTask(
2578 BrowserThread::IO, FROM_HERE, 2578 BrowserThread::IO, FROM_HERE,
2579 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, 2579 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess,
2580 system_->info_map(), 2580 system_->info_map(),
2581 process->GetID())); 2581 process->GetID()));
2582 break; 2582 break;
2583 } 2583 }
2584 case chrome::NOTIFICATION_PREF_CHANGED: {
2585 const std::string& pref_name =
2586 *content::Details<std::string>(details).ptr();
2587 DCHECK(pref_name == prefs::kExtensionInstallAllowList ||
2588 pref_name == prefs::kExtensionInstallDenyList)
2589 << "Unexpected preference name " << pref_name;
2590 IdentifyAlertableExtensions();
2591 CheckManagementPolicy();
2592 break;
2593 }
2594 case chrome::NOTIFICATION_IMPORT_FINISHED: { 2584 case chrome::NOTIFICATION_IMPORT_FINISHED: {
2595 InitAfterImport(); 2585 InitAfterImport();
2596 break; 2586 break;
2597 } 2587 }
2598 2588
2599 default: 2589 default:
2600 NOTREACHED() << "Unexpected notification type."; 2590 NOTREACHED() << "Unexpected notification type.";
2601 } 2591 }
2602 } 2592 }
2603 2593
2594 void ExtensionService::OnPreferenceChanged(PrefServiceBase* service,
2595 const std::string& pref_name) {
2596 DCHECK(pref_name == prefs::kExtensionInstallAllowList ||
2597 pref_name == prefs::kExtensionInstallDenyList)
2598 << "Unexpected preference name " << pref_name;
2599 IdentifyAlertableExtensions();
2600 CheckManagementPolicy();
2601 }
2602
2604 bool ExtensionService::HasApps() const { 2603 bool ExtensionService::HasApps() const {
2605 return !GetAppIds().empty(); 2604 return !GetAppIds().empty();
2606 } 2605 }
2607 2606
2608 ExtensionIdSet ExtensionService::GetAppIds() const { 2607 ExtensionIdSet ExtensionService::GetAppIds() const {
2609 ExtensionIdSet result; 2608 ExtensionIdSet result;
2610 for (ExtensionSet::const_iterator it = extensions_.begin(); 2609 for (ExtensionSet::const_iterator it = extensions_.begin();
2611 it != extensions_.end(); ++it) { 2610 it != extensions_.end(); ++it) {
2612 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) 2611 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT)
2613 result.insert((*it)->id()); 2612 result.insert((*it)->id());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 // External extensions are initially disabled. We prompt the user before 2823 // External extensions are initially disabled. We prompt the user before
2825 // enabling them. 2824 // enabling them.
2826 if (Extension::IsExternalLocation(extension->location()) && 2825 if (Extension::IsExternalLocation(extension->location()) &&
2827 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { 2826 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) {
2828 return false; 2827 return false;
2829 } 2828 }
2830 } 2829 }
2831 2830
2832 return true; 2831 return true;
2833 } 2832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698