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

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

Issue 8380006: Exempt component and policy-installed extensions from policy blacklist check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 9 years, 2 months 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) 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_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_pref_store.h" 10 #include "chrome/browser/extensions/extension_pref_store.h"
11 #include "chrome/browser/prefs/pref_notifier.h" 11 #include "chrome/browser/prefs/pref_notifier.h"
12 #include "chrome/browser/prefs/scoped_user_pref_update.h" 12 #include "chrome/browser/prefs/scoped_user_pref_update.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/url_constants.h"
15 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/extensions/url_pattern.h" 15 #include "chrome/common/extensions/url_pattern.h"
17 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/common/url_constants.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 19
20 using base::Time; 20 using base::Time;
21 21
22 namespace { 22 namespace {
23 23
24 // The number of apps per page. This isn't a hard limit, but new apps installed 24 // The number of apps per page. This isn't a hard limit, but new apps installed
25 // from the webstore will overflow onto a new page if this limit is reached. 25 // from the webstore will overflow onto a new page if this limit is reached.
26 const int kNaturalAppPageSize = 18; 26 const int kNaturalAppPageSize = 18;
27 27
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 bool ExtensionPrefs::SetAlertSystemFirstRun() { 581 bool ExtensionPrefs::SetAlertSystemFirstRun() {
582 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) { 582 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) {
583 return true; 583 return true;
584 } 584 }
585 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true); 585 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true);
586 return false; 586 return false;
587 } 587 }
588 588
589 bool ExtensionPrefs::IsExtensionAllowedByPolicy( 589 bool ExtensionPrefs::IsExtensionAllowedByPolicy(
590 const std::string& extension_id) { 590 const std::string& extension_id,
591 Extension::Location location) {
591 std::string string_value; 592 std::string string_value;
592 593
594 if (location == Extension::COMPONENT ||
595 location == Extension::EXTERNAL_POLICY_DOWNLOAD) {
596 return true;
597 }
598
593 const ListValue* blacklist = 599 const ListValue* blacklist =
594 prefs_->GetList(prefs::kExtensionInstallDenyList); 600 prefs_->GetList(prefs::kExtensionInstallDenyList);
595 if (!blacklist || blacklist->empty()) 601 if (!blacklist || blacklist->empty())
596 return true; 602 return true;
597 603
598 // Check the whitelist first. 604 // Check the whitelist first.
599 const ListValue* whitelist = 605 const ListValue* whitelist =
600 prefs_->GetList(prefs::kExtensionInstallAllowList); 606 prefs_->GetList(prefs::kExtensionInstallAllowList);
601 if (whitelist) { 607 if (whitelist) {
602 for (ListValue::const_iterator it = whitelist->begin(); 608 for (ListValue::const_iterator it = whitelist->begin();
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, 1798 prefs->RegisterListPref(prefs::kExtensionInstallAllowList,
1793 PrefService::UNSYNCABLE_PREF); 1799 PrefService::UNSYNCABLE_PREF);
1794 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, 1800 prefs->RegisterListPref(prefs::kExtensionInstallDenyList,
1795 PrefService::UNSYNCABLE_PREF); 1801 PrefService::UNSYNCABLE_PREF);
1796 prefs->RegisterListPref(prefs::kExtensionInstallForceList, 1802 prefs->RegisterListPref(prefs::kExtensionInstallForceList,
1797 PrefService::UNSYNCABLE_PREF); 1803 PrefService::UNSYNCABLE_PREF);
1798 prefs->RegisterStringPref(kWebStoreLogin, 1804 prefs->RegisterStringPref(kWebStoreLogin,
1799 std::string() /* default_value */, 1805 std::string() /* default_value */,
1800 PrefService::UNSYNCABLE_PREF); 1806 PrefService::UNSYNCABLE_PREF);
1801 } 1807 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698