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

Unified Diff: chrome/browser/crash_upload_list.h

Issue 6545001: Implement chrome://crashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Presubmit fix Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/crash_upload_list.h
diff --git a/chrome/browser/crash_upload_list.h b/chrome/browser/crash_upload_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..58c5ed08079e5243e47e78d7f179e7d02f3360d0
--- /dev/null
+++ b/chrome/browser/crash_upload_list.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_CRASH_UPLOAD_LIST_H_
+#define CHROME_BROWSER_CRASH_UPLOAD_LIST_H_
+#pragma once
+
+#include "base/ref_counted.h"
+#include "base/time.h"
+
+#include <string>
+#include <vector>
+
+class CrashUploadList : public base::RefCountedThreadSafe<CrashUploadList> {
+ public:
+ struct CrashInfo {
Nico 2011/02/18 18:16:01 erg would probably like it if you would have expli
stuartmorgan 2011/02/18 19:41:21 Whoops, I forgot about that email. Thanks for the
+ std::string crash_id;
+ base::Time crash_time;
+ };
+
+ class Delegate {
+ public:
+ // Invoked when the crash list has been loaded.
Nico 2011/02/18 18:16:01 Maybe mention which thread the delegate will be ca
stuartmorgan 2011/02/18 19:41:21 Done.
+ virtual void OnCrashListAvailable() = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ // Creates a new crash upload list with the given callback delegate.
+ explicit CrashUploadList(Delegate* delegate);
+
+ // Starts loading the crash list. OnCrashListAvailable will be called when
+ // loading is complete.
+ void LoadCrashListAsynchronously();
+
+ // Clears the delegate, so that any outstanding asynchronous load will not
+ // call the delegate on completion.
+ void ClearDelegate();
+
+ // Populates |crashes| with the |max_count| most recent uploaded crashes,
+ // in reverse chronological order.
+ // Must be called only after OnCrashListAvailable has been called.
+ void GetUploadedCrashes(unsigned int max_count,
+ std::vector<CrashInfo>* crashes);
+
+ private:
+ friend class base::RefCountedThreadSafe<CrashUploadList>;
+ virtual ~CrashUploadList();
+
+ // Reads the upload log and stores the lines in log_entries_.
+ void LoadUploadLog();
+
+ // Calls the delegate's callback method, if there is a delegate.
+ void InformDelegateOfCompletion();
+
+ std::vector<std::string> log_entries_;
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(CrashUploadList);
+};
+
+#endif // CHROME_BROWSER_CRASH_UPLOAD_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698