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

Side by Side Diff: chrome/browser/extensions/api/preference/preference_api.cc

Issue 2418813002: [Reland] Refactoring of SBER preference usage (Closed)
Patch Set: Fix static init in preference_api Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/api/preference/preference_api.h" 5 #include "chrome/browser/extensions/api/preference/preference_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/extensions/extension_service.h" 25 #include "chrome/browser/extensions/extension_service.h"
26 #include "chrome/browser/net/prediction_options.h" 26 #include "chrome/browser/net/prediction_options.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "components/autofill/core/common/autofill_pref_names.h" 29 #include "components/autofill/core/common/autofill_pref_names.h"
30 #include "components/content_settings/core/common/pref_names.h" 30 #include "components/content_settings/core/common/pref_names.h"
31 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" 31 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h"
32 #include "components/password_manager/core/common/password_manager_pref_names.h" 32 #include "components/password_manager/core/common/password_manager_pref_names.h"
33 #include "components/prefs/pref_service.h" 33 #include "components/prefs/pref_service.h"
34 #include "components/proxy_config/proxy_config_pref_names.h" 34 #include "components/proxy_config/proxy_config_pref_names.h"
35 #include "components/safe_browsing_db/safe_browsing_prefs.h"
35 #include "components/spellcheck/browser/pref_names.h" 36 #include "components/spellcheck/browser/pref_names.h"
36 #include "components/translate/core/common/translate_pref_names.h" 37 #include "components/translate/core/common/translate_pref_names.h"
37 #include "content/public/browser/notification_details.h" 38 #include "content/public/browser/notification_details.h"
38 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
39 #include "extensions/browser/extension_pref_value_map.h" 40 #include "extensions/browser/extension_pref_value_map.h"
40 #include "extensions/browser/extension_pref_value_map_factory.h" 41 #include "extensions/browser/extension_pref_value_map_factory.h"
41 #include "extensions/browser/extension_prefs.h" 42 #include "extensions/browser/extension_prefs.h"
42 #include "extensions/browser/extension_prefs_factory.h" 43 #include "extensions/browser/extension_prefs_factory.h"
43 #include "extensions/browser/extension_system_provider.h" 44 #include "extensions/browser/extension_system_provider.h"
44 #include "extensions/browser/extensions_browser_client.h" 45 #include "extensions/browser/extensions_browser_client.h"
(...skipping 28 matching lines...) Expand all
73 // write permission should not be granted. 74 // write permission should not be granted.
74 APIPermission::ID write_permission; 75 APIPermission::ID write_permission;
75 }; 76 };
76 77
77 const char kOnPrefChangeFormat[] = "types.ChromeSetting.%s.onChange"; 78 const char kOnPrefChangeFormat[] = "types.ChromeSetting.%s.onChange";
78 const char kConversionErrorMessage[] = 79 const char kConversionErrorMessage[] =
79 "Internal error: Stored value for preference '*' cannot be converted " 80 "Internal error: Stored value for preference '*' cannot be converted "
80 "properly."; 81 "properly.";
81 82
82 PrefMappingEntry kPrefMapping[] = { 83 PrefMappingEntry kPrefMapping[] = {
83 {"spdy_proxy.enabled", 84 {"spdy_proxy.enabled", prefs::kDataSaverEnabled,
84 prefs::kDataSaverEnabled,
85 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy}, 85 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy},
86 {"data_reduction.daily_original_length", 86 {"data_reduction.daily_original_length",
87 data_reduction_proxy::prefs::kDailyHttpOriginalContentLength, 87 data_reduction_proxy::prefs::kDailyHttpOriginalContentLength,
88 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy}, 88 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy},
89 {"data_reduction.daily_received_length", 89 {"data_reduction.daily_received_length",
90 data_reduction_proxy::prefs::kDailyHttpReceivedContentLength, 90 data_reduction_proxy::prefs::kDailyHttpReceivedContentLength,
91 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy}, 91 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy},
92 {"data_usage_reporting.enabled", 92 {"data_usage_reporting.enabled",
93 data_reduction_proxy::prefs::kDataUsageReportingEnabled, 93 data_reduction_proxy::prefs::kDataUsageReportingEnabled,
94 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy}, 94 APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy},
(...skipping 12 matching lines...) Expand all
107 APIPermission::kPrivacy, APIPermission::kPrivacy}, 107 APIPermission::kPrivacy, APIPermission::kPrivacy},
108 {"protectedContentEnabled", prefs::kEnableDRM, APIPermission::kPrivacy, 108 {"protectedContentEnabled", prefs::kEnableDRM, APIPermission::kPrivacy,
109 APIPermission::kPrivacy}, 109 APIPermission::kPrivacy},
110 {"proxy", proxy_config::prefs::kProxy, APIPermission::kProxy, 110 {"proxy", proxy_config::prefs::kProxy, APIPermission::kProxy,
111 APIPermission::kProxy}, 111 APIPermission::kProxy},
112 {"referrersEnabled", prefs::kEnableReferrers, APIPermission::kPrivacy, 112 {"referrersEnabled", prefs::kEnableReferrers, APIPermission::kPrivacy,
113 APIPermission::kPrivacy}, 113 APIPermission::kPrivacy},
114 {"safeBrowsingEnabled", prefs::kSafeBrowsingEnabled, 114 {"safeBrowsingEnabled", prefs::kSafeBrowsingEnabled,
115 APIPermission::kPrivacy, APIPermission::kPrivacy}, 115 APIPermission::kPrivacy, APIPermission::kPrivacy},
116 {"safeBrowsingExtendedReportingEnabled", 116 {"safeBrowsingExtendedReportingEnabled",
117 prefs::kSafeBrowsingExtendedReportingEnabled, APIPermission::kPrivacy, 117 prefs::kSafeBrowsingExtendedReportingEnabled, APIPermission::kPrivacy,
lazyboy 2016/10/13 21:20:59 I thought you wanted dynamic name here, is it not
lpz 2016/10/13 22:27:34 I'll do it separately, since this CL is big enough
118 APIPermission::kPrivacy}, 118 APIPermission::kPrivacy},
119 {"searchSuggestEnabled", prefs::kSearchSuggestEnabled, 119 {"searchSuggestEnabled", prefs::kSearchSuggestEnabled,
120 APIPermission::kPrivacy, APIPermission::kPrivacy}, 120 APIPermission::kPrivacy, APIPermission::kPrivacy},
121 {"spellingServiceEnabled", spellcheck::prefs::kSpellCheckUseSpellingService, 121 {"spellingServiceEnabled", spellcheck::prefs::kSpellCheckUseSpellingService,
122 APIPermission::kPrivacy, APIPermission::kPrivacy}, 122 APIPermission::kPrivacy, APIPermission::kPrivacy},
123 {"thirdPartyCookiesAllowed", prefs::kBlockThirdPartyCookies, 123 {"thirdPartyCookiesAllowed", prefs::kBlockThirdPartyCookies,
124 APIPermission::kPrivacy, APIPermission::kPrivacy}, 124 APIPermission::kPrivacy, APIPermission::kPrivacy},
125 {"translationServiceEnabled", prefs::kEnableTranslate, 125 {"translationServiceEnabled", prefs::kEnableTranslate,
126 APIPermission::kPrivacy, APIPermission::kPrivacy}, 126 APIPermission::kPrivacy, APIPermission::kPrivacy},
127 #if defined(ENABLE_WEBRTC) 127 #if defined(ENABLE_WEBRTC)
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 pref_key, &browser_pref, &read_permission, &write_permission)); 773 pref_key, &browser_pref, &read_permission, &write_permission));
774 if (!extension()->permissions_data()->HasAPIPermission(write_permission)) 774 if (!extension()->permissions_data()->HasAPIPermission(write_permission))
775 return RespondNow(Error(keys::kPermissionErrorMessage, pref_key)); 775 return RespondNow(Error(keys::kPermissionErrorMessage, pref_key));
776 776
777 PreferenceAPI::Get(browser_context()) 777 PreferenceAPI::Get(browser_context())
778 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); 778 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope);
779 return RespondNow(NoArguments()); 779 return RespondNow(NoArguments());
780 } 780 }
781 781
782 } // namespace extensions 782 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/BUILD.gn ('k') | chrome/browser/interstitials/chrome_controller_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698