OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Most of this code is copied from various classes in | 5 // Most of this code is copied from various classes in |
6 // src/chrome/browser/policy. In particular, look at | 6 // src/chrome/browser/policy. In particular, look at |
7 // | 7 // |
8 // file_based_policy_loader.{h,cc} | 8 // file_based_policy_loader.{h,cc} |
9 // config_dir_policy_provider.{h,cc} | 9 // config_dir_policy_provider.{h,cc} |
10 // | 10 // |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 config_file_iter != files.end(); ++config_file_iter) { | 142 config_file_iter != files.end(); ++config_file_iter) { |
143 JSONFileValueSerializer deserializer(*config_file_iter); | 143 JSONFileValueSerializer deserializer(*config_file_iter); |
144 deserializer.set_allow_trailing_comma(true); | 144 deserializer.set_allow_trailing_comma(true); |
145 int error_code = 0; | 145 int error_code = 0; |
146 std::string error_msg; | 146 std::string error_msg; |
147 scoped_ptr<base::Value> value( | 147 scoped_ptr<base::Value> value( |
148 deserializer.Deserialize(&error_code, &error_msg)); | 148 deserializer.Deserialize(&error_code, &error_msg)); |
149 if (!value.get()) { | 149 if (!value.get()) { |
150 LOG(WARNING) << "Failed to read configuration file " | 150 LOG(WARNING) << "Failed to read configuration file " |
151 << config_file_iter->value() << ": " << error_msg; | 151 << config_file_iter->value() << ": " << error_msg; |
152 return scoped_ptr<base::DictionaryValue>(); | 152 return nullptr; |
153 } | 153 } |
154 if (!value->IsType(base::Value::TYPE_DICTIONARY)) { | 154 if (!value->IsType(base::Value::TYPE_DICTIONARY)) { |
155 LOG(WARNING) << "Expected JSON dictionary in configuration file " | 155 LOG(WARNING) << "Expected JSON dictionary in configuration file " |
156 << config_file_iter->value(); | 156 << config_file_iter->value(); |
157 return scoped_ptr<base::DictionaryValue>(); | 157 return nullptr; |
158 } | 158 } |
159 policy->MergeDictionary(static_cast<base::DictionaryValue*>(value.get())); | 159 policy->MergeDictionary(static_cast<base::DictionaryValue*>(value.get())); |
160 } | 160 } |
161 | 161 |
162 return policy.Pass(); | 162 return policy.Pass(); |
163 } | 163 } |
164 | 164 |
165 virtual void Reload() OVERRIDE { | 165 virtual void Reload() OVERRIDE { |
166 DCHECK(OnPolicyWatcherThread()); | 166 DCHECK(OnPolicyWatcherThread()); |
167 // Check the directory time in order to see whether a reload is required. | 167 // Check the directory time in order to see whether a reload is required. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 }; | 245 }; |
246 | 246 |
247 PolicyWatcher* PolicyWatcher::Create( | 247 PolicyWatcher* PolicyWatcher::Create( |
248 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
249 base::FilePath policy_dir(kPolicyDir); | 249 base::FilePath policy_dir(kPolicyDir); |
250 return new PolicyWatcherLinux(task_runner, policy_dir); | 250 return new PolicyWatcherLinux(task_runner, policy_dir); |
251 } | 251 } |
252 | 252 |
253 } // namespace policy_hack | 253 } // namespace policy_hack |
254 } // namespace remoting | 254 } // namespace remoting |
OLD | NEW |