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

Unified Diff: chrome/browser/chromeos/system_logs/user_log_source.cc

Issue 11035014: Collect user logs that debugd can not access (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/system_logs/user_log_source.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system_logs/user_log_source.cc
diff --git a/chrome/browser/chromeos/system_logs/user_log_source.cc b/chrome/browser/chromeos/system_logs/user_log_source.cc
new file mode 100644
index 0000000000000000000000000000000000000000..807ba3258070ad029ab7bb8b003d4c18c3e17ae8
--- /dev/null
+++ b/chrome/browser/chromeos/system_logs/user_log_source.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/system_logs/user_log_source.h"
+
+#include <string>
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "content/public/browser/browser_thread.h"
+
+using content::BrowserThread;
+
+namespace chromeos {
+
+void UserLogSource::Fetch(const SysLogsSourceCallback& callback) {
+ DCHECK(!callback.is_null());
+
+ SystemLogsResponse* response = new SystemLogsResponse;
+ BrowserThread::PostBlockingPoolTaskAndReply(
+ FROM_HERE,
+ base::Bind(&UserLogSource::ReadUserLogs, response),
+ base::Bind(callback,
+ base::Owned(response)));
+}
+
+struct KeyFilePair {
+ const char* key;
+ const char* file;
+};
+
+// static
+void UserLogSource::ReadUserLogs(SystemLogsResponse* response) {
+ KeyFilePair user_logs[] = {
+ {"chrome_user_log", "/home/chronos/user/log/chrome"},
DaveMoore 2012/10/08 18:10:28 I would prefer that the knowledge about exactly wh
gauravsh 2012/10/08 18:13:59 When you say server, do you mean the feedback serv
+ {"login-times", "/home/chronos/user/login-times"},
+ {"logout-times", "/home/chronos/user/logout-times"}
+ };
+ for (size_t i = 0; i < arraysize(user_logs); ++i) {
+ std::string value;
+ bool read_success = file_util::ReadFileToString(
+ FilePath(user_logs[i].file), &value);
+ if (read_success && !value.empty())
+ (*response)[user_logs[i].key] = value;
+ else
+ (*response)[user_logs[i].key] = "<no value>";
+ }
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/system_logs/user_log_source.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698