| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/setup/daemon_controller_delegate_win.h" | 5 #include "remoting/host/setup/daemon_controller_delegate_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // The configuration keys whose values may be read by GetConfig(). | 62 // The configuration keys whose values may be read by GetConfig(). |
| 63 const char* const kUnprivilegedConfigKeys[] = { | 63 const char* const kUnprivilegedConfigKeys[] = { |
| 64 kHostIdConfigPath, kXmppLoginConfigPath }; | 64 kHostIdConfigPath, kXmppLoginConfigPath }; |
| 65 | 65 |
| 66 // Reads and parses the configuration file up to |kMaxConfigFileSize| in | 66 // Reads and parses the configuration file up to |kMaxConfigFileSize| in |
| 67 // size. | 67 // size. |
| 68 bool ReadConfig(const base::FilePath& filename, | 68 bool ReadConfig(const base::FilePath& filename, |
| 69 scoped_ptr<base::DictionaryValue>* config_out) { | 69 scoped_ptr<base::DictionaryValue>* config_out) { |
| 70 std::string file_content; | 70 std::string file_content; |
| 71 if (!base::ReadFileToString(filename, &file_content, kMaxConfigFileSize)) { | 71 if (!base::ReadFileToStringWithMaxSize(filename, &file_content, |
| 72 kMaxConfigFileSize)) { |
| 72 PLOG(ERROR) << "Failed to read '" << filename.value() << "'."; | 73 PLOG(ERROR) << "Failed to read '" << filename.value() << "'."; |
| 73 return false; | 74 return false; |
| 74 } | 75 } |
| 75 | 76 |
| 76 // Parse the JSON configuration, expecting it to contain a dictionary. | 77 // Parse the JSON configuration, expecting it to contain a dictionary. |
| 77 scoped_ptr<base::Value> value = | 78 scoped_ptr<base::Value> value = |
| 78 base::JSONReader::Read(file_content, base::JSON_ALLOW_TRAILING_COMMAS); | 79 base::JSONReader::Read(file_content, base::JSON_ALLOW_TRAILING_COMMAS); |
| 79 | 80 |
| 80 base::DictionaryValue* dictionary; | 81 base::DictionaryValue* dictionary; |
| 81 if (!value || !value->GetAsDictionary(&dictionary)) { | 82 if (!value || !value->GetAsDictionary(&dictionary)) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 // Start daemon. | 467 // Start daemon. |
| 467 InvokeCompletionCallback(done, StartDaemon()); | 468 InvokeCompletionCallback(done, StartDaemon()); |
| 468 } | 469 } |
| 469 | 470 |
| 470 scoped_refptr<DaemonController> DaemonController::Create() { | 471 scoped_refptr<DaemonController> DaemonController::Create() { |
| 471 return new DaemonController( | 472 return new DaemonController( |
| 472 make_scoped_ptr(new DaemonControllerDelegateWin())); | 473 make_scoped_ptr(new DaemonControllerDelegateWin())); |
| 473 } | 474 } |
| 474 | 475 |
| 475 } // namespace remoting | 476 } // namespace remoting |
| OLD | NEW |