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

Side by Side Diff: chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h" 5 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 SystemLogsResponse* response) { 153 SystemLogsResponse* response) {
154 for (size_t i = 0; i < last_used_profiles.size(); ++i) { 154 for (size_t i = 0; i < last_used_profiles.size(); ++i) {
155 std::string profile_prefix = "Profile[" + base::UintToString(i) + "] "; 155 std::string profile_prefix = "Profile[" + base::UintToString(i) + "] ";
156 for (KeyValueMap::const_iterator it = user_log_files.begin(); 156 for (KeyValueMap::const_iterator it = user_log_files.begin();
157 it != user_log_files.end(); 157 it != user_log_files.end();
158 ++it) { 158 ++it) {
159 std::string key = it->first; 159 std::string key = it->first;
160 std::string value; 160 std::string value;
161 std::string filename = it->second; 161 std::string filename = it->second;
162 base::FilePath profile_dir = last_used_profiles[i]->GetPath(); 162 base::FilePath profile_dir = last_used_profiles[i]->GetPath();
163 bool read_success = file_util::ReadFileToString( 163 bool read_success = base::ReadFileToString(
164 profile_dir.Append(filename), &value); 164 profile_dir.Append(filename), &value);
165 165
166 if (read_success && !value.empty()) 166 if (read_success && !value.empty())
167 (*response)[profile_prefix + key] = value; 167 (*response)[profile_prefix + key] = value;
168 else 168 else
169 (*response)[profile_prefix + filename] = kNotAvailable; 169 (*response)[profile_prefix + filename] = kNotAvailable;
170 } 170 }
171 } 171 }
172 } 172 }
173 173
174 void DebugDaemonLogSource::MergeResponse(SystemLogsResponse* response) { 174 void DebugDaemonLogSource::MergeResponse(SystemLogsResponse* response) {
175 for (SystemLogsResponse::const_iterator it = response->begin(); 175 for (SystemLogsResponse::const_iterator it = response->begin();
176 it != response->end(); ++it) 176 it != response->end(); ++it)
177 response_->insert(*it); 177 response_->insert(*it);
178 RequestCompleted(); 178 RequestCompleted();
179 } 179 }
180 180
181 void DebugDaemonLogSource::RequestCompleted() { 181 void DebugDaemonLogSource::RequestCompleted() {
182 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 182 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
183 DCHECK(!callback_.is_null()); 183 DCHECK(!callback_.is_null());
184 184
185 --num_pending_requests_; 185 --num_pending_requests_;
186 if (num_pending_requests_ > 0) 186 if (num_pending_requests_ > 0)
187 return; 187 return;
188 callback_.Run(response_.get()); 188 callback_.Run(response_.get());
189 } 189 }
190 190
191 } // namespace chromeos 191 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/syslogs_provider.cc ('k') | chrome/browser/chromeos/system_logs/lsb_release_log_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698