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

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

Issue 382673002: Fixes for re-enabling more MSVC level 4 warnings: misc edition #2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/extension_prefs.h" 5 #include "extensions/browser/extension_prefs.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_notifier.h" 10 #include "base/prefs/pref_notifier.h"
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 new base::FundamentalValue(active)); 997 new base::FundamentalValue(active));
998 } 998 }
999 999
1000 void ExtensionPrefs::MigratePermissions(const ExtensionIdList& extension_ids) { 1000 void ExtensionPrefs::MigratePermissions(const ExtensionIdList& extension_ids) {
1001 PermissionsInfo* info = PermissionsInfo::GetInstance(); 1001 PermissionsInfo* info = PermissionsInfo::GetInstance();
1002 for (ExtensionIdList::const_iterator ext_id = 1002 for (ExtensionIdList::const_iterator ext_id =
1003 extension_ids.begin(); ext_id != extension_ids.end(); ++ext_id) { 1003 extension_ids.begin(); ext_id != extension_ids.end(); ++ext_id) {
1004 // An extension's granted permissions need to be migrated if the 1004 // An extension's granted permissions need to be migrated if the
1005 // full_access bit is present. This bit was always present in the previous 1005 // full_access bit is present. This bit was always present in the previous
1006 // scheme and is never present now. 1006 // scheme and is never present now.
1007 bool full_access; 1007 bool full_access = false;
1008 const base::DictionaryValue* ext = GetExtensionPref(*ext_id); 1008 const base::DictionaryValue* ext = GetExtensionPref(*ext_id);
1009 if (!ext || !ext->GetBoolean(kPrefOldGrantedFullAccess, &full_access)) 1009 if (!ext || !ext->GetBoolean(kPrefOldGrantedFullAccess, &full_access))
1010 continue; 1010 continue;
1011 1011
1012 // Remove the full access bit (empty list will get trimmed). 1012 // Remove the full access bit (empty list will get trimmed).
1013 UpdateExtensionPref( 1013 UpdateExtensionPref(
1014 *ext_id, kPrefOldGrantedFullAccess, new base::ListValue()); 1014 *ext_id, kPrefOldGrantedFullAccess, new base::ListValue());
1015 1015
1016 // Add the plugin permission if the full access bit was set. 1016 // Add the plugin permission if the full access bit was set.
1017 if (full_access) { 1017 if (full_access) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 SetExtensionBlacklisted(extension_id, state == BLACKLISTED_MALWARE); 1280 SetExtensionBlacklisted(extension_id, state == BLACKLISTED_MALWARE);
1281 UpdateExtensionPref(extension_id, kPrefBlacklistState, 1281 UpdateExtensionPref(extension_id, kPrefBlacklistState,
1282 new base::FundamentalValue(state)); 1282 new base::FundamentalValue(state));
1283 } 1283 }
1284 1284
1285 BlacklistState ExtensionPrefs::GetExtensionBlacklistState( 1285 BlacklistState ExtensionPrefs::GetExtensionBlacklistState(
1286 const std::string& extension_id) { 1286 const std::string& extension_id) {
1287 if (IsExtensionBlacklisted(extension_id)) 1287 if (IsExtensionBlacklisted(extension_id))
1288 return BLACKLISTED_MALWARE; 1288 return BLACKLISTED_MALWARE;
1289 const base::DictionaryValue* ext_prefs = GetExtensionPref(extension_id); 1289 const base::DictionaryValue* ext_prefs = GetExtensionPref(extension_id);
1290 int int_value; 1290 int int_value = 0;
1291 if (ext_prefs && ext_prefs->GetInteger(kPrefBlacklistState, &int_value)) 1291 if (ext_prefs && ext_prefs->GetInteger(kPrefBlacklistState, &int_value))
1292 return static_cast<BlacklistState>(int_value); 1292 return static_cast<BlacklistState>(int_value);
1293 1293
1294 return NOT_BLACKLISTED; 1294 return NOT_BLACKLISTED;
1295 } 1295 }
1296 1296
1297 std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) { 1297 std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
1298 const base::DictionaryValue* extension = GetExtensionPref(extension_id); 1298 const base::DictionaryValue* extension = GetExtensionPref(extension_id);
1299 if (!extension) 1299 if (!extension)
1300 return std::string(); 1300 return std::string();
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 extension_pref_value_map_->RegisterExtension( 2180 extension_pref_value_map_->RegisterExtension(
2181 extension_id, install_time, is_enabled, is_incognito_enabled); 2181 extension_id, install_time, is_enabled, is_incognito_enabled);
2182 2182
2183 FOR_EACH_OBSERVER( 2183 FOR_EACH_OBSERVER(
2184 ExtensionPrefsObserver, 2184 ExtensionPrefsObserver,
2185 observer_list_, 2185 observer_list_,
2186 OnExtensionRegistered(extension_id, install_time, is_enabled)); 2186 OnExtensionRegistered(extension_id, install_time, is_enabled));
2187 } 2187 }
2188 2188
2189 } // namespace extensions 2189 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698