OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.h" | 7 #include "base/string_util.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/prefs/pref_notifier.h" | 10 #include "chrome/browser/prefs/pref_notifier.h" |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 if (!ext || !ext->GetBoolean(kPrefGrantedPermissionsAll, full_access)) | 480 if (!ext || !ext->GetBoolean(kPrefGrantedPermissionsAll, full_access)) |
481 return false; | 481 return false; |
482 | 482 |
483 ReadExtensionPrefStringSet( | 483 ReadExtensionPrefStringSet( |
484 extension_id, kPrefGrantedPermissionsAPI, api_permissions); | 484 extension_id, kPrefGrantedPermissionsAPI, api_permissions); |
485 | 485 |
486 std::set<std::string> host_permissions; | 486 std::set<std::string> host_permissions; |
487 ReadExtensionPrefStringSet( | 487 ReadExtensionPrefStringSet( |
488 extension_id, kPrefGrantedPermissionsHost, &host_permissions); | 488 extension_id, kPrefGrantedPermissionsHost, &host_permissions); |
489 | 489 |
| 490 // The granted host permissions contain hosts from the manifest's |
| 491 // "permissions" array and from the content script "matches" arrays, |
| 492 // so the URLPattern needs to accept valid schemes from both types. |
490 for (std::set<std::string>::iterator i = host_permissions.begin(); | 493 for (std::set<std::string>::iterator i = host_permissions.begin(); |
491 i != host_permissions.end(); ++i) | 494 i != host_permissions.end(); ++i) |
492 host_extent->AddPattern(URLPattern( | 495 host_extent->AddPattern(URLPattern( |
493 Extension::kValidWebExtentSchemes | UserScript::kValidUserScriptSchemes, | 496 Extension::kValidHostPermissionSchemes | |
| 497 UserScript::kValidUserScriptSchemes, |
494 *i)); | 498 *i)); |
495 | 499 |
496 return true; | 500 return true; |
497 } | 501 } |
498 | 502 |
499 void ExtensionPrefs::AddGrantedPermissions( | 503 void ExtensionPrefs::AddGrantedPermissions( |
500 const std::string& extension_id, | 504 const std::string& extension_id, |
501 const bool full_access, | 505 const bool full_access, |
502 const std::set<std::string>& api_permissions, | 506 const std::set<std::string>& api_permissions, |
503 const ExtensionExtent& host_extent) { | 507 const ExtensionExtent& host_extent) { |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 1098 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
1095 prefs->RegisterDictionaryPref(kExtensionsPref); | 1099 prefs->RegisterDictionaryPref(kExtensionsPref); |
1096 prefs->RegisterListPref(kExtensionToolbar); | 1100 prefs->RegisterListPref(kExtensionToolbar); |
1097 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 1101 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
1098 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 1102 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
1099 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); | 1103 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); |
1100 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); | 1104 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); |
1101 prefs->RegisterListPref(prefs::kExtensionInstallForceList); | 1105 prefs->RegisterListPref(prefs::kExtensionInstallForceList); |
1102 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); | 1106 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); |
1103 } | 1107 } |
OLD | NEW |