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[] = "newAllowFileAccess"; | 77 const char kPrefAllowFileAccess[] = "allowFileAccess"; |
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"; | |
82 | 78 |
83 // A preference set by the web store to indicate login information for | 79 // A preference set by the web store to indicate login information for |
84 // purchased apps. | 80 // purchased apps. |
85 const char kWebStoreLogin[] = "extensions.webstore_login"; | 81 const char kWebStoreLogin[] = "extensions.webstore_login"; |
86 | 82 |
87 // A preference set by the the NTP to persist the desired launch container type | 83 // A preference set by the the NTP to persist the desired launch container type |
88 // used for apps. | 84 // used for apps. |
89 const char kPrefLaunchType[] = "launchType"; | 85 const char kPrefLaunchType[] = "launchType"; |
90 | 86 |
91 // A preference determining the order of which the apps appear on the NTP. | 87 // 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... |
801 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) { | 797 bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) { |
802 return ReadExtensionPrefBoolean(extension_id, kPrefAllowFileAccess); | 798 return ReadExtensionPrefBoolean(extension_id, kPrefAllowFileAccess); |
803 } | 799 } |
804 | 800 |
805 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, | 801 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
806 bool allow) { | 802 bool allow) { |
807 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, | 803 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, |
808 Value::CreateBooleanValue(allow)); | 804 Value::CreateBooleanValue(allow)); |
809 } | 805 } |
810 | 806 |
| 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 |
811 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( | 813 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( |
812 const std::string& extension_id, | 814 const std::string& extension_id, |
813 ExtensionPrefs::LaunchType default_pref_value) { | 815 ExtensionPrefs::LaunchType default_pref_value) { |
814 int value = -1; | 816 int value = -1; |
815 LaunchType result = LAUNCH_REGULAR; | 817 LaunchType result = LAUNCH_REGULAR; |
816 | 818 |
817 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && | 819 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && |
818 (value == LAUNCH_PINNED || | 820 (value == LAUNCH_PINNED || |
819 value == LAUNCH_REGULAR || | 821 value == LAUNCH_REGULAR || |
820 value == LAUNCH_FULLSCREEN || | 822 value == LAUNCH_FULLSCREEN || |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1665 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
1664 PrefService::UNSYNCABLE_PREF); | 1666 PrefService::UNSYNCABLE_PREF); |
1665 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1667 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
1666 PrefService::UNSYNCABLE_PREF); | 1668 PrefService::UNSYNCABLE_PREF); |
1667 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1669 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
1668 PrefService::UNSYNCABLE_PREF); | 1670 PrefService::UNSYNCABLE_PREF); |
1669 prefs->RegisterStringPref(kWebStoreLogin, | 1671 prefs->RegisterStringPref(kWebStoreLogin, |
1670 std::string() /* default_value */, | 1672 std::string() /* default_value */, |
1671 PrefService::UNSYNCABLE_PREF); | 1673 PrefService::UNSYNCABLE_PREF); |
1672 } | 1674 } |
OLD | NEW |