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

Side by Side Diff: components/policy/core/browser/android/policy_converter.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/policy/core/browser/android/policy_converter.h" 5 #include "components/policy/core/browser/android/policy_converter.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // static 107 // static
108 std::unique_ptr<base::Value> PolicyConverter::ConvertValueToSchema( 108 std::unique_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
109 std::unique_ptr<base::Value> value, 109 std::unique_ptr<base::Value> value,
110 const Schema& schema) { 110 const Schema& schema) {
111 if (!schema.valid()) 111 if (!schema.valid())
112 return value; 112 return value;
113 113
114 switch (schema.type()) { 114 switch (schema.type()) {
115 case base::Value::Type::NONE: 115 case base::Value::Type::NONE:
116 return base::Value::CreateNullValue(); 116 return base::MakeUnique<base::Value>();
117 117
118 case base::Value::Type::BOOLEAN: { 118 case base::Value::Type::BOOLEAN: {
119 std::string string_value; 119 std::string string_value;
120 if (value->GetAsString(&string_value)) { 120 if (value->GetAsString(&string_value)) {
121 if (string_value.compare("true") == 0) 121 if (string_value.compare("true") == 0)
122 return base::MakeUnique<base::Value>(true); 122 return base::MakeUnique<base::Value>(true);
123 123
124 if (string_value.compare("false") == 0) 124 if (string_value.compare("false") == 0)
125 return base::MakeUnique<base::Value>(false); 125 return base::MakeUnique<base::Value>(false);
126 126
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 std::unique_ptr<base::Value> value) { 191 std::unique_ptr<base::Value> value) {
192 const Schema schema = policy_schema_->GetKnownProperty(key); 192 const Schema schema = policy_schema_->GetKnownProperty(key);
193 const PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string()); 193 const PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string());
194 policy_bundle_->Get(ns).Set( 194 policy_bundle_->Get(ns).Set(
195 key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, 195 key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM,
196 ConvertValueToSchema(std::move(value), schema), nullptr); 196 ConvertValueToSchema(std::move(value), schema), nullptr);
197 } 197 }
198 198
199 } // namespace android 199 } // namespace android
200 } // namespace policy 200 } // namespace policy
OLDNEW
« no previous file with comments | « components/json_schema/json_schema_validator_unittest_base.cc ('k') | components/policy/core/common/mac_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698