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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 const char kIdleInstallInfoCrxPath[] = "crx_path"; | 67 const char kIdleInstallInfoCrxPath[] = "crx_path"; |
68 const char kIdleInstallInfoVersion[] = "version"; | 68 const char kIdleInstallInfoVersion[] = "version"; |
69 const char kIdleInstallInfoFetchTime[] = "fetch_time"; | 69 const char kIdleInstallInfoFetchTime[] = "fetch_time"; |
70 | 70 |
71 // A preference that, if true, will allow this extension to run in incognito | 71 // A preference that, if true, will allow this extension to run in incognito |
72 // mode. | 72 // mode. |
73 const char kPrefIncognitoEnabled[] = "incognito"; | 73 const char kPrefIncognitoEnabled[] = "incognito"; |
74 | 74 |
75 // A preference to control whether an extension is allowed to inject script in | 75 // A preference to control whether an extension is allowed to inject script in |
76 // pages with file URLs. | 76 // pages with file URLs. |
77 const char kPrefAllowFileAccess[] = "allowFileAccess"; | 77 const char kPrefAllowFileAccess[] = "newAllowFileAccess"; |
| 78 // TODO(jstritar): As part of fixing http://crbug.com/91577, we revoked all |
| 79 // extension file access by renaming the pref. We should eventually clean up |
| 80 // the old flag and possibly go back to that name. |
| 81 // const char kPrefAllowFileAccessOld[] = "allowFileAccess"; |
78 | 82 |
79 // A preference set by the web store to indicate login information for | 83 // A preference set by the web store to indicate login information for |
80 // purchased apps. | 84 // purchased apps. |
81 const char kWebStoreLogin[] = "extensions.webstore_login"; | 85 const char kWebStoreLogin[] = "extensions.webstore_login"; |
82 | 86 |
83 // A preference set by the the NTP to persist the desired launch container type | 87 // A preference set by the the NTP to persist the desired launch container type |
84 // used for apps. | 88 // used for apps. |
85 const char kPrefLaunchType[] = "launchType"; | 89 const char kPrefLaunchType[] = "launchType"; |
86 | 90 |
87 // A preference determining the order of which the apps appear on the NTP. | 91 // A preference determining the order of which the apps appear on the NTP. |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) { | 801 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) { |
798 return ReadExtensionPrefBoolean(extension_id, kPrefAllowFileAccess); | 802 return ReadExtensionPrefBoolean(extension_id, kPrefAllowFileAccess); |
799 } | 803 } |
800 | 804 |
801 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, | 805 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
802 bool allow) { | 806 bool allow) { |
803 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, | 807 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, |
804 Value::CreateBooleanValue(allow)); | 808 Value::CreateBooleanValue(allow)); |
805 } | 809 } |
806 | 810 |
807 bool ExtensionPrefs::HasAllowFileAccessSetting( | |
808 const std::string& extension_id) const { | |
809 const DictionaryValue* ext = GetExtensionPref(extension_id); | |
810 return ext && ext->HasKey(kPrefAllowFileAccess); | |
811 } | |
812 | |
813 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( | 811 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( |
814 const std::string& extension_id, | 812 const std::string& extension_id, |
815 ExtensionPrefs::LaunchType default_pref_value) { | 813 ExtensionPrefs::LaunchType default_pref_value) { |
816 int value = -1; | 814 int value = -1; |
817 LaunchType result = LAUNCH_REGULAR; | 815 LaunchType result = LAUNCH_REGULAR; |
818 | 816 |
819 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && | 817 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && |
820 (value == LAUNCH_PINNED || | 818 (value == LAUNCH_PINNED || |
821 value == LAUNCH_REGULAR || | 819 value == LAUNCH_REGULAR || |
822 value == LAUNCH_FULLSCREEN || | 820 value == LAUNCH_FULLSCREEN || |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1663 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
1666 PrefService::UNSYNCABLE_PREF); | 1664 PrefService::UNSYNCABLE_PREF); |
1667 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1665 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
1668 PrefService::UNSYNCABLE_PREF); | 1666 PrefService::UNSYNCABLE_PREF); |
1669 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1667 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
1670 PrefService::UNSYNCABLE_PREF); | 1668 PrefService::UNSYNCABLE_PREF); |
1671 prefs->RegisterStringPref(kWebStoreLogin, | 1669 prefs->RegisterStringPref(kWebStoreLogin, |
1672 std::string() /* default_value */, | 1670 std::string() /* default_value */, |
1673 PrefService::UNSYNCABLE_PREF); | 1671 PrefService::UNSYNCABLE_PREF); |
1674 } | 1672 } |
OLD | NEW |