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

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: Fix PrefNotifierImpl 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 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 break; 2583 break;
2584 2584
2585 process_map_.RemoveAllFromProcess(process->GetID()); 2585 process_map_.RemoveAllFromProcess(process->GetID());
2586 BrowserThread::PostTask( 2586 BrowserThread::PostTask(
2587 BrowserThread::IO, FROM_HERE, 2587 BrowserThread::IO, FROM_HERE,
2588 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, 2588 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess,
2589 system_->info_map(), 2589 system_->info_map(),
2590 process->GetID())); 2590 process->GetID()));
2591 break; 2591 break;
2592 } 2592 }
2593 case chrome::NOTIFICATION_PREF_CHANGED: {
2594 std::string* pref_name = content::Details<std::string>(details).ptr();
2595 if (*pref_name == prefs::kExtensionInstallAllowList ||
2596 *pref_name == prefs::kExtensionInstallDenyList) {
2597 IdentifyAlertableExtensions();
2598 CheckManagementPolicy();
2599 } else {
2600 NOTREACHED() << "Unexpected preference name.";
2601 }
2602 break;
2603 }
2604 case chrome::NOTIFICATION_IMPORT_FINISHED: { 2593 case chrome::NOTIFICATION_IMPORT_FINISHED: {
2605 InitAfterImport(); 2594 InitAfterImport();
2606 break; 2595 break;
2607 } 2596 }
2608 2597
2609 default: 2598 default:
2610 NOTREACHED() << "Unexpected notification type."; 2599 NOTREACHED() << "Unexpected notification type.";
2611 } 2600 }
2612 } 2601 }
2613 2602
2603 void ExtensionService::OnPreferenceChanged(PrefServiceBase* service,
2604 const std::string& pref_name) {
2605 if (pref_name == prefs::kExtensionInstallAllowList ||
2606 pref_name == prefs::kExtensionInstallDenyList) {
2607 IdentifyAlertableExtensions();
2608 CheckManagementPolicy();
2609 } else {
2610 NOTREACHED() << "Unexpected preference name.";
2611 }
2612 }
2613
2614 bool ExtensionService::HasApps() const { 2614 bool ExtensionService::HasApps() const {
2615 return !GetAppIds().empty(); 2615 return !GetAppIds().empty();
2616 } 2616 }
2617 2617
2618 ExtensionIdSet ExtensionService::GetAppIds() const { 2618 ExtensionIdSet ExtensionService::GetAppIds() const {
2619 ExtensionIdSet result; 2619 ExtensionIdSet result;
2620 for (ExtensionSet::const_iterator it = extensions_.begin(); 2620 for (ExtensionSet::const_iterator it = extensions_.begin();
2621 it != extensions_.end(); ++it) { 2621 it != extensions_.end(); ++it) {
2622 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) 2622 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT)
2623 result.insert((*it)->id()); 2623 result.insert((*it)->id());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 // External extensions are initially disabled. We prompt the user before 2834 // External extensions are initially disabled. We prompt the user before
2835 // enabling them. 2835 // enabling them.
2836 if (Extension::IsExternalLocation(extension->location()) && 2836 if (Extension::IsExternalLocation(extension->location()) &&
2837 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { 2837 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) {
2838 return false; 2838 return false;
2839 } 2839 }
2840 } 2840 }
2841 2841
2842 return true; 2842 return true;
2843 } 2843 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698