| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |