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

Side by Side Diff: remoting/host/elevated_controller_win.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 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 | Annotate | Revision Log
OLDNEW
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 #include "remoting/host/elevated_controller_win.h" 5 #include "remoting/host/elevated_controller_win.h"
6 6
7 #include <sddl.h> 7 #include <sddl.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DWORD size = kMaxConfigFileSize; 67 DWORD size = kMaxConfigFileSize;
68 if (!::ReadFile(file, &buffer[0], size, &size, NULL)) { 68 if (!::ReadFile(file, &buffer[0], size, &size, NULL)) {
69 DWORD error = GetLastError(); 69 DWORD error = GetLastError();
70 LOG_GETLASTERROR(ERROR) 70 LOG_GETLASTERROR(ERROR)
71 << "Failed to read '" << filename.value() << "'"; 71 << "Failed to read '" << filename.value() << "'";
72 return HRESULT_FROM_WIN32(error); 72 return HRESULT_FROM_WIN32(error);
73 } 73 }
74 74
75 // Parse the JSON configuration, expecting it to contain a dictionary. 75 // Parse the JSON configuration, expecting it to contain a dictionary.
76 std::string file_content(buffer.get(), size); 76 std::string file_content(buffer.get(), size);
77 scoped_ptr<base::Value> value(base::JSONReader::Read(file_content, true)); 77 scoped_ptr<base::Value> value(
78 base::JSONReader::Read(file_content, base::JSON_ALLOW_TRAILING_COMMAS));
78 79
79 base::DictionaryValue* dictionary; 80 base::DictionaryValue* dictionary;
80 if (value.get() == NULL || !value->GetAsDictionary(&dictionary)) { 81 if (value.get() == NULL || !value->GetAsDictionary(&dictionary)) {
81 LOG(ERROR) << "Failed to read '" << filename.value() << "'."; 82 LOG(ERROR) << "Failed to read '" << filename.value() << "'.";
82 return E_FAIL; 83 return E_FAIL;
83 } 84 }
84 85
85 value.release(); 86 value.release();
86 config_out->reset(dictionary); 87 config_out->reset(dictionary);
87 return S_OK; 88 return S_OK;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 << "Failed to open to the '" << kWindowsServiceName << "' service"; 288 << "Failed to open to the '" << kWindowsServiceName << "' service";
288 289
289 return HRESULT_FROM_WIN32(error); 290 return HRESULT_FROM_WIN32(error);
290 } 291 }
291 292
292 service_out->Set(service.Take()); 293 service_out->Set(service.Take());
293 return S_OK; 294 return S_OK;
294 } 295 }
295 296
296 } // namespace remoting 297 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698