OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/policy/default_geolocation_policy_handler.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 #include "chrome/common/pref_names.h" |
| 9 #include "components/content_settings/core/common/content_settings.h" |
| 10 #include "components/policy/core/common/policy_map.h" |
| 11 #include "components/prefs/pref_value_map.h" |
| 12 #include "policy/policy_constants.h" |
| 13 |
| 14 namespace policy { |
| 15 |
| 16 DefaultGeolocationPolicyHandler::DefaultGeolocationPolicyHandler() |
| 17 : IntRangePolicyHandlerBase(key::kDefaultGeolocationSetting, 1, 3, false) {} |
| 18 |
| 19 DefaultGeolocationPolicyHandler::~DefaultGeolocationPolicyHandler() {} |
| 20 |
| 21 void DefaultGeolocationPolicyHandler::ApplyPolicySettings( |
| 22 const PolicyMap& policies, PrefValueMap* prefs) { |
| 23 const base::Value* const value = policies.GetValue(policy_name()); |
| 24 int value_in_range; |
| 25 if (value && EnsureInRange(value, &value_in_range, nullptr) |
| 26 && value_in_range == CONTENT_SETTING_BLOCK) { |
| 27 // CONTENT_SETTING_BLOCK = BlockGeolocation |
| 28 prefs->SetBoolean(prefs::kArcLocationServiceEnabled, false); |
| 29 } |
| 30 } |
| 31 |
| 32 } // namespace policy |
OLD | NEW |