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

Side by Side Diff: chrome/browser/policy/network_prediction_policy_handler.cc

Issue 2149253003: Switch various ValueTypeToString()s to base::Value::GetTypeName(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@value
Patch Set: fix tests Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/policy/network_prediction_policy_handler.h" 5 #include "chrome/browser/policy/network_prediction_policy_handler.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/net/prediction_options.h" 8 #include "chrome/browser/net/prediction_options.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "components/policy/core/browser/policy_error_map.h" 10 #include "components/policy/core/browser/policy_error_map.h"
(...skipping 15 matching lines...) Expand all
26 PolicyErrorMap* errors) { 26 PolicyErrorMap* errors) {
27 // Deprecated boolean preference. 27 // Deprecated boolean preference.
28 const base::Value* network_prediction_enabled = 28 const base::Value* network_prediction_enabled =
29 policies.GetValue(key::kDnsPrefetchingEnabled); 29 policies.GetValue(key::kDnsPrefetchingEnabled);
30 // New enumerated preference. 30 // New enumerated preference.
31 const base::Value* network_prediction_options = 31 const base::Value* network_prediction_options =
32 policies.GetValue(key::kNetworkPredictionOptions); 32 policies.GetValue(key::kNetworkPredictionOptions);
33 33
34 if (network_prediction_enabled && 34 if (network_prediction_enabled &&
35 !network_prediction_enabled->IsType(base::Value::TYPE_BOOLEAN)) { 35 !network_prediction_enabled->IsType(base::Value::TYPE_BOOLEAN)) {
36 errors->AddError(key::kDnsPrefetchingEnabled, 36 errors->AddError(key::kDnsPrefetchingEnabled, IDS_POLICY_TYPE_ERROR,
37 IDS_POLICY_TYPE_ERROR, 37 base::Value::GetTypeName(base::Value::TYPE_BOOLEAN));
38 ValueTypeToString(base::Value::TYPE_BOOLEAN));
39 } 38 }
40 39
41 if (network_prediction_options && 40 if (network_prediction_options &&
42 !network_prediction_options->IsType(base::Value::TYPE_INTEGER)) { 41 !network_prediction_options->IsType(base::Value::TYPE_INTEGER)) {
43 errors->AddError(key::kNetworkPredictionOptions, 42 errors->AddError(key::kNetworkPredictionOptions, IDS_POLICY_TYPE_ERROR,
44 IDS_POLICY_TYPE_ERROR, 43 base::Value::GetTypeName(base::Value::TYPE_INTEGER));
45 ValueTypeToString(base::Value::TYPE_INTEGER));
46 } 44 }
47 45
48 if (network_prediction_enabled && network_prediction_options) { 46 if (network_prediction_enabled && network_prediction_options) {
49 errors->AddError(key::kDnsPrefetchingEnabled, 47 errors->AddError(key::kDnsPrefetchingEnabled,
50 IDS_POLICY_OVERRIDDEN, 48 IDS_POLICY_OVERRIDDEN,
51 key::kNetworkPredictionOptions); 49 key::kNetworkPredictionOptions);
52 } 50 }
53 51
54 return true; 52 return true;
55 } 53 }
(...skipping 22 matching lines...) Expand all
78 // kNetworkPredictionEnabled = true is translated to 76 // kNetworkPredictionEnabled = true is translated to
79 // kNetworkPredictionOptions = WIFI_ONLY. 77 // kNetworkPredictionOptions = WIFI_ONLY.
80 prefs->SetInteger(prefs::kNetworkPredictionOptions, 78 prefs->SetInteger(prefs::kNetworkPredictionOptions,
81 bool_setting 79 bool_setting
82 ? chrome_browser_net::NETWORK_PREDICTION_WIFI_ONLY 80 ? chrome_browser_net::NETWORK_PREDICTION_WIFI_ONLY
83 : chrome_browser_net::NETWORK_PREDICTION_NEVER); 81 : chrome_browser_net::NETWORK_PREDICTION_NEVER);
84 } 82 }
85 } 83 }
86 84
87 } // namespace policy 85 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698