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

Unified Diff: chrome/browser/extensions/api/preference/preference_api.cc

Issue 670223002: Revert of Update extension preference API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/preference/preference_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/preference/preference_api.cc
diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc
index 36b98ce1889b41b28a933ba57a7fcd13822123fc..c4cf8a62d6943923af65dc37f7ae80a5ca614968 100644
--- a/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chrome/browser/extensions/api/preference/preference_api.cc
@@ -20,7 +20,6 @@
#include "chrome/browser/extensions/api/preference/preference_helpers.h"
#include "chrome/browser/extensions/api/proxy/proxy_api.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/translate/core/common/translate_pref_names.h"
@@ -76,7 +75,9 @@
APIPermission::kPrivacy, APIPermission::kPrivacy},
{"hyperlinkAuditingEnabled", prefs::kEnableHyperlinkAuditing,
APIPermission::kPrivacy, APIPermission::kPrivacy},
- {"networkPredictionEnabled", prefs::kNetworkPredictionOptions,
+ {"networkPredictionEnabled", prefs::kNetworkPredictionEnabled,
+ APIPermission::kPrivacy, APIPermission::kPrivacy},
+ {"networkPredictionOptions", prefs::kNetworkPredictionOptions,
APIPermission::kPrivacy, APIPermission::kPrivacy},
{"passwordSavingEnabled",
password_manager::prefs::kPasswordManagerSavingEnabled,
@@ -157,31 +158,6 @@
}
};
-class NetworkPredictionTransformer : public PrefTransformerInterface {
- public:
- virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref,
- std::string* error,
- bool* bad_message) override {
- bool bool_value = false;
- DCHECK(extension_pref->GetAsBoolean(&bool_value));
- if (bool_value) {
- return new base::FundamentalValue(
- chrome_browser_net::NETWORK_PREDICTION_DEFAULT);
- } else {
- return new base::FundamentalValue(
- chrome_browser_net::NETWORK_PREDICTION_NEVER);
- }
- }
-
- virtual base::Value* BrowserToExtensionPref(
- const base::Value* browser_pref) override {
- int int_value = chrome_browser_net::NETWORK_PREDICTION_NEVER;
- DCHECK(browser_pref->GetAsInteger(&int_value));
- return new base::FundamentalValue(
- int_value != chrome_browser_net::NETWORK_PREDICTION_NEVER);
- }
-};
-
class PrefMapping {
public:
static PrefMapping* GetInstance() {
@@ -247,8 +223,6 @@
RegisterPrefTransformer(prefs::kProxy, new ProxyPrefTransformer());
RegisterPrefTransformer(prefs::kBlockThirdPartyCookies,
new InvertBooleanTransformer());
- RegisterPrefTransformer(prefs::kNetworkPredictionOptions,
- new NetworkPredictionTransformer());
}
~PrefMapping() {
@@ -676,6 +650,7 @@
CHECK(pref);
// Validate new value.
+ EXTENSION_FUNCTION_VALIDATE(value->GetType() == pref->GetType());
PrefTransformerInterface* transformer =
PrefMapping::GetInstance()->FindTransformerForBrowserPref(browser_pref);
std::string error;
@@ -687,7 +662,6 @@
bad_message_ = bad_message;
return false;
}
- EXTENSION_FUNCTION_VALIDATE(browser_pref_value->GetType() == pref->GetType());
// Validate also that the stored value can be converted back by the
// transformer.
« no previous file with comments | « no previous file | chrome/browser/extensions/api/preference/preference_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698