| OLD | NEW |
| 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" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 std::string item; | 391 std::string item; |
| 392 if (!value->GetString(i, &item)) | 392 if (!value->GetString(i, &item)) |
| 393 return false; | 393 return false; |
| 394 URLPattern pattern(valid_schemes); | 394 URLPattern pattern(valid_schemes); |
| 395 if (pattern.Parse(item, URLPattern::IGNORE_PORTS) != | 395 if (pattern.Parse(item, URLPattern::IGNORE_PORTS) != |
| 396 URLPattern::PARSE_SUCCESS) { | 396 URLPattern::PARSE_SUCCESS) { |
| 397 NOTREACHED(); | 397 NOTREACHED(); |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| 400 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) { | 400 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) { |
| 401 pattern.set_valid_schemes( | 401 pattern.SetValidSchemes( |
| 402 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); | 402 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); |
| 403 } | 403 } |
| 404 result->AddPattern(pattern); | 404 result->AddPattern(pattern); |
| 405 } | 405 } |
| 406 | 406 |
| 407 return true; | 407 return true; |
| 408 } | 408 } |
| 409 | 409 |
| 410 void ExtensionPrefs::SetExtensionPrefURLPatternSet( | 410 void ExtensionPrefs::SetExtensionPrefURLPatternSet( |
| 411 const std::string& extension_id, | 411 const std::string& extension_id, |
| 412 const std::string& pref_key, | 412 const std::string& pref_key, |
| 413 const URLPatternSet& new_value) { | 413 const URLPatternSet& new_value) { |
| 414 ListValue* value = new ListValue(); | 414 ListValue* value = new ListValue(); |
| 415 for (URLPatternList::const_iterator i = new_value.patterns().begin(); | 415 for (URLPatternSet::const_iterator i = new_value.begin(); |
| 416 i != new_value.patterns().end(); ++i) | 416 i != new_value.end(); ++i) |
| 417 value->AppendIfNotPresent(Value::CreateStringValue(i->GetAsString())); | 417 value->AppendIfNotPresent(Value::CreateStringValue(i->GetAsString())); |
| 418 | 418 |
| 419 UpdateExtensionPref(extension_id, pref_key, value); | 419 UpdateExtensionPref(extension_id, pref_key, value); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void ExtensionPrefs::SavePrefs() { | 422 void ExtensionPrefs::SavePrefs() { |
| 423 prefs_->ScheduleSavePersistentPrefs(); | 423 prefs_->ScheduleSavePersistentPrefs(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 // static | 426 // static |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1610 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
| 1611 PrefService::UNSYNCABLE_PREF); | 1611 PrefService::UNSYNCABLE_PREF); |
| 1612 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1612 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
| 1613 PrefService::UNSYNCABLE_PREF); | 1613 PrefService::UNSYNCABLE_PREF); |
| 1614 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1614 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
| 1615 PrefService::UNSYNCABLE_PREF); | 1615 PrefService::UNSYNCABLE_PREF); |
| 1616 prefs->RegisterStringPref(kWebStoreLogin, | 1616 prefs->RegisterStringPref(kWebStoreLogin, |
| 1617 std::string() /* default_value */, | 1617 std::string() /* default_value */, |
| 1618 PrefService::UNSYNCABLE_PREF); | 1618 PrefService::UNSYNCABLE_PREF); |
| 1619 } | 1619 } |
| OLD | NEW |