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

Side by Side Diff: components/policy/core/common/policy_loader_win.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/policy/core/common/policy_loader_win.h" 5 #include "components/policy/core/common/policy_loader_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <lm.h> // For limits. 8 #include <lm.h> // For limits.
9 #include <ntdsapi.h> // For Ds[Un]Bind 9 #include <ntdsapi.h> // For Ds[Un]Bind
10 #include <rpc.h> // For struct GUID 10 #include <rpc.h> // For struct GUID
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 policy_schema->GetString(schema::kType, &type) && 121 policy_schema->GetString(schema::kType, &type) &&
122 type == schema::kArray && 122 type == schema::kArray &&
123 !policy_schema->HasKey(schema::kItems)) { 123 !policy_schema->HasKey(schema::kItems)) {
124 scoped_ptr<base::DictionaryValue> items(new base::DictionaryValue()); 124 scoped_ptr<base::DictionaryValue> items(new base::DictionaryValue());
125 items->SetString(schema::kType, schema::kString); 125 items->SetString(schema::kType, schema::kString);
126 policy_schema->Set(schema::kItems, items.release()); 126 policy_schema->Set(schema::kItems, items.release());
127 } 127 }
128 } 128 }
129 129
130 std::string serialized; 130 std::string serialized;
131 base::JSONWriter::Write(json.get(), &serialized); 131 base::JSONWriter::Write(*json, &serialized);
132 return serialized; 132 return serialized;
133 } 133 }
134 134
135 // Verifies that untrusted policies contain only safe values. Modifies the 135 // Verifies that untrusted policies contain only safe values. Modifies the
136 // |policy| in place. 136 // |policy| in place.
137 void FilterUntrustedPolicy(PolicyMap* policy) { 137 void FilterUntrustedPolicy(PolicyMap* policy) {
138 if (base::win::IsEnrolledToDomain()) 138 if (base::win::IsEnrolledToDomain())
139 return; 139 return;
140 140
141 int invalid_policies = 0; 141 int invalid_policies = 0;
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 683
684 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { 684 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) {
685 DCHECK(object == user_policy_changed_event_.handle() || 685 DCHECK(object == user_policy_changed_event_.handle() ||
686 object == machine_policy_changed_event_.handle()) 686 object == machine_policy_changed_event_.handle())
687 << "unexpected object signaled policy reload, obj = " 687 << "unexpected object signaled policy reload, obj = "
688 << std::showbase << std::hex << object; 688 << std::showbase << std::hex << object;
689 Reload(false); 689 Reload(false);
690 } 690 }
691 691
692 } // namespace policy 692 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698