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

Unified Diff: chrome/browser/policy/default_geolocation_policy_handler.cc

Issue 2243513002: arc: Make Location Service manageable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: chrome/browser/policy/default_geolocation_policy_handler.cc
diff --git a/chrome/browser/policy/default_geolocation_policy_handler.cc b/chrome/browser/policy/default_geolocation_policy_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..84382cff7e2baecc30311bb8fe99ae8c9f821392
--- /dev/null
+++ b/chrome/browser/policy/default_geolocation_policy_handler.cc
@@ -0,0 +1,30 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/policy/default_geolocation_policy_handler.h"
bartfab (slow) 2016/08/17 14:52:06 Nit: Add a blank line after this.
khmel 2016/08/17 15:16:21 Done.
+#include "chrome/common/pref_names.h"
+#include "components/policy/core/common/policy_map.h"
+#include "components/prefs/pref_value_map.h"
+#include "policy/policy_constants.h"
+
+namespace policy {
+
+#if defined(OS_CHROMEOS)
+DefaultGeolocationPolicyHandler::DefaultGeolocationPolicyHandler()
+ : IntRangePolicyHandlerBase(key::kDefaultGeolocationSetting, 1, 3, false) {}
+
+DefaultGeolocationPolicyHandler::~DefaultGeolocationPolicyHandler() {}
+
+void DefaultGeolocationPolicyHandler::ApplyPolicySettings(
+ const PolicyMap& policies, PrefValueMap* prefs) {
+ const base::Value* value = policies.GetValue(policy_name());
bartfab (slow) 2016/08/17 14:52:06 Nit 1: const pointer. Nit 2: #include "base/values
khmel 2016/08/17 15:16:21 Done.
+ int value_in_range;
+ if (value && EnsureInRange(value, &value_in_range, NULL)
bartfab (slow) 2016/08/17 14:52:06 Nit: s/NULL/nullptr/
khmel 2016/08/17 15:16:21 Done.
+ && value_in_range == 2) { // 2 = BlockGeolocation
bartfab (slow) 2016/08/17 14:52:06 Nit: There is a constant for that, CONTENT_SETTING
khmel 2016/08/17 15:16:21 Done.
+ prefs->SetBoolean(prefs::kArcLocationServiceEnabled, false);
+ }
+}
+#endif
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698