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

Side by Side Diff: remoting/host/setup/daemon_controller_delegate_win.cc

Issue 1719983005: base: Stop overloading ReadFileToString() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix errors Created 4 years, 10 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
« no previous file with comments | « content/browser/webui/web_ui_mojo_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_mojo_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698