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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 if (!ReadExtensionPrefList(extension_id, pref_key, &value)) | 425 if (!ReadExtensionPrefList(extension_id, pref_key, &value)) |
426 return false; | 426 return false; |
427 | 427 |
428 result->ClearPatterns(); | 428 result->ClearPatterns(); |
429 bool allow_file_access = AllowFileAccess(extension_id); | 429 bool allow_file_access = AllowFileAccess(extension_id); |
430 | 430 |
431 for (size_t i = 0; i < value->GetSize(); ++i) { | 431 for (size_t i = 0; i < value->GetSize(); ++i) { |
432 std::string item; | 432 std::string item; |
433 if (!value->GetString(i, &item)) | 433 if (!value->GetString(i, &item)) |
434 return false; | 434 return false; |
435 URLPattern pattern(valid_schemes); | 435 URLPattern pattern(URLPattern::IGNORE_PORTS, valid_schemes); |
436 if (pattern.Parse(item, URLPattern::IGNORE_PORTS) != | 436 if (pattern.Parse(item) != URLPattern::PARSE_SUCCESS) { |
437 URLPattern::PARSE_SUCCESS) { | |
438 NOTREACHED(); | 437 NOTREACHED(); |
439 return false; | 438 return false; |
440 } | 439 } |
441 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) { | 440 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) { |
442 pattern.SetValidSchemes( | 441 pattern.SetValidSchemes( |
443 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); | 442 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); |
444 } | 443 } |
445 result->AddPattern(pattern); | 444 result->AddPattern(pattern); |
446 } | 445 } |
447 | 446 |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1828 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
1830 PrefService::UNSYNCABLE_PREF); | 1829 PrefService::UNSYNCABLE_PREF); |
1831 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1830 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
1832 PrefService::UNSYNCABLE_PREF); | 1831 PrefService::UNSYNCABLE_PREF); |
1833 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1832 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
1834 PrefService::UNSYNCABLE_PREF); | 1833 PrefService::UNSYNCABLE_PREF); |
1835 prefs->RegisterStringPref(kWebStoreLogin, | 1834 prefs->RegisterStringPref(kWebStoreLogin, |
1836 std::string() /* default_value */, | 1835 std::string() /* default_value */, |
1837 PrefService::UNSYNCABLE_PREF); | 1836 PrefService::UNSYNCABLE_PREF); |
1838 } | 1837 } |
OLD | NEW |