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_preference_api.h" | 5 #include "chrome/browser/extensions/extension_preference_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 const char kPermissionErrorMessage[] = | 46 const char kPermissionErrorMessage[] = |
47 "You do not have permission to access the preference '%s'. " | 47 "You do not have permission to access the preference '%s'. " |
48 "Be sure to declare in your manifest what permissions you need."; | 48 "Be sure to declare in your manifest what permissions you need."; |
49 | 49 |
50 PrefMappingEntry kPrefMapping[] = { | 50 PrefMappingEntry kPrefMapping[] = { |
51 { "blockThirdPartyCookies", | 51 { "blockThirdPartyCookies", |
52 prefs::kBlockThirdPartyCookies, | 52 prefs::kBlockThirdPartyCookies, |
53 Extension::kContentSettingsPermission | 53 Extension::kContentSettingsPermission |
54 }, | 54 }, |
| 55 { "enableReferrers", |
| 56 prefs::kEnableReferrers, |
| 57 Extension::kContentSettingsPermission |
| 58 }, |
| 59 { "enableHyperlinkAuditing", |
| 60 prefs::kEnableHyperlinkAuditing, |
| 61 Extension::kContentSettingsPermission |
| 62 }, |
55 { "proxy", | 63 { "proxy", |
56 prefs::kProxy, | 64 prefs::kProxy, |
57 Extension::kProxyPermission | 65 Extension::kProxyPermission |
58 }, | 66 }, |
59 }; | 67 }; |
60 | 68 |
61 class IdentityPrefTransformer : public PrefTransformerInterface { | 69 class IdentityPrefTransformer : public PrefTransformerInterface { |
62 public: | 70 public: |
63 IdentityPrefTransformer() { } | 71 IdentityPrefTransformer() { } |
64 virtual ~IdentityPrefTransformer() { } | 72 virtual ~IdentityPrefTransformer() { } |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 PrefMapping::GetInstance()->FindBrowserPrefForExtensionPref( | 403 PrefMapping::GetInstance()->FindBrowserPrefForExtensionPref( |
396 pref_key, &browser_pref, &permission)); | 404 pref_key, &browser_pref, &permission)); |
397 if (!GetExtension()->HasApiPermission(permission)) { | 405 if (!GetExtension()->HasApiPermission(permission)) { |
398 error_ = base::StringPrintf(kPermissionErrorMessage, pref_key.c_str()); | 406 error_ = base::StringPrintf(kPermissionErrorMessage, pref_key.c_str()); |
399 return false; | 407 return false; |
400 } | 408 } |
401 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); | 409 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); |
402 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, incognito); | 410 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, incognito); |
403 return true; | 411 return true; |
404 } | 412 } |
OLD | NEW |