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

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

Issue 7229012: Use extension match pattern syntax in content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize port Created 9 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 (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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return false; 444 return false;
445 445
446 result->ClearPatterns(); 446 result->ClearPatterns();
447 bool allow_file_access = AllowFileAccess(extension_id); 447 bool allow_file_access = AllowFileAccess(extension_id);
448 448
449 for (size_t i = 0; i < value->GetSize(); ++i) { 449 for (size_t i = 0; i < value->GetSize(); ++i) {
450 std::string item; 450 std::string item;
451 if (!value->GetString(i, &item)) 451 if (!value->GetString(i, &item))
452 return false; 452 return false;
453 URLPattern pattern(valid_schemes); 453 URLPattern pattern(valid_schemes);
454 if (pattern.Parse(item, URLPattern::PARSE_LENIENT) != 454 if (pattern.Parse(item, URLPattern::IGNORE_PORTS) !=
455 URLPattern::PARSE_SUCCESS) { 455 URLPattern::PARSE_SUCCESS) {
456 NOTREACHED(); 456 NOTREACHED();
457 return false; 457 return false;
458 } 458 }
459 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) { 459 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) {
460 pattern.set_valid_schemes( 460 pattern.set_valid_schemes(
461 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); 461 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE);
462 } 462 }
463 result->AddPattern(pattern); 463 result->AddPattern(pattern);
464 } 464 }
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, 1660 prefs->RegisterListPref(prefs::kExtensionInstallAllowList,
1661 PrefService::UNSYNCABLE_PREF); 1661 PrefService::UNSYNCABLE_PREF);
1662 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, 1662 prefs->RegisterListPref(prefs::kExtensionInstallDenyList,
1663 PrefService::UNSYNCABLE_PREF); 1663 PrefService::UNSYNCABLE_PREF);
1664 prefs->RegisterListPref(prefs::kExtensionInstallForceList, 1664 prefs->RegisterListPref(prefs::kExtensionInstallForceList,
1665 PrefService::UNSYNCABLE_PREF); 1665 PrefService::UNSYNCABLE_PREF);
1666 prefs->RegisterStringPref(kWebStoreLogin, 1666 prefs->RegisterStringPref(kWebStoreLogin,
1667 std::string() /* default_value */, 1667 std::string() /* default_value */,
1668 PrefService::UNSYNCABLE_PREF); 1668 PrefService::UNSYNCABLE_PREF);
1669 } 1669 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698