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

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

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 14 matching lines...) Expand all
25 const PolicyMap& policies, 25 const PolicyMap& policies,
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, IDS_POLICY_TYPE_ERROR, 36 errors->AddError(key::kDnsPrefetchingEnabled, IDS_POLICY_TYPE_ERROR,
37 base::Value::GetTypeName(base::Value::TYPE_BOOLEAN)); 37 base::Value::GetTypeName(base::Value::Type::BOOLEAN));
38 } 38 }
39 39
40 if (network_prediction_options && 40 if (network_prediction_options &&
41 !network_prediction_options->IsType(base::Value::TYPE_INTEGER)) { 41 !network_prediction_options->IsType(base::Value::Type::INTEGER)) {
42 errors->AddError(key::kNetworkPredictionOptions, IDS_POLICY_TYPE_ERROR, 42 errors->AddError(key::kNetworkPredictionOptions, IDS_POLICY_TYPE_ERROR,
43 base::Value::GetTypeName(base::Value::TYPE_INTEGER)); 43 base::Value::GetTypeName(base::Value::Type::INTEGER));
44 } 44 }
45 45
46 if (network_prediction_enabled && network_prediction_options) { 46 if (network_prediction_enabled && network_prediction_options) {
47 errors->AddError(key::kDnsPrefetchingEnabled, 47 errors->AddError(key::kDnsPrefetchingEnabled,
48 IDS_POLICY_OVERRIDDEN, 48 IDS_POLICY_OVERRIDDEN,
49 key::kNetworkPredictionOptions); 49 key::kNetworkPredictionOptions);
50 } 50 }
51 51
52 return true; 52 return true;
53 } 53 }
(...skipping 22 matching lines...) Expand all
76 // kNetworkPredictionEnabled = true is translated to 76 // kNetworkPredictionEnabled = true is translated to
77 // kNetworkPredictionOptions = WIFI_ONLY. 77 // kNetworkPredictionOptions = WIFI_ONLY.
78 prefs->SetInteger(prefs::kNetworkPredictionOptions, 78 prefs->SetInteger(prefs::kNetworkPredictionOptions,
79 bool_setting 79 bool_setting
80 ? chrome_browser_net::NETWORK_PREDICTION_WIFI_ONLY 80 ? chrome_browser_net::NETWORK_PREDICTION_WIFI_ONLY
81 : chrome_browser_net::NETWORK_PREDICTION_NEVER); 81 : chrome_browser_net::NETWORK_PREDICTION_NEVER);
82 } 82 }
83 } 83 }
84 84
85 } // namespace policy 85 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/javascript_policy_handler.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698