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

Unified Diff: components/proximity_auth/logging/log_buffer.h

Issue 1135293002: Hook up PA_LOG() logs to chrome://proximity-auth WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stop using release() Created 5 years, 7 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 | « no previous file | components/proximity_auth/logging/log_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/logging/log_buffer.h
diff --git a/components/proximity_auth/logging/log_buffer.h b/components/proximity_auth/logging/log_buffer.h
index 3fefd68b24cda61f5d0ed22772536537dd766243..dd554bc497d438fc2d218af6d0d242d9aa226f0c 100644
--- a/components/proximity_auth/logging/log_buffer.h
+++ b/components/proximity_auth/logging/log_buffer.h
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/macros.h"
+#include "base/observer_list.h"
#include "base/time/time.h"
namespace proximity_auth {
@@ -33,12 +34,25 @@ class LogBuffer {
logging::LogSeverity severity);
};
+ class Observer {
+ public:
+ // Called when a new message is added to the log buffer.
+ virtual void OnLogMessageAdded(const LogMessage& log_message) = 0;
+
+ // Called when all messages in the log buffer are cleared.
+ virtual void OnLogBufferCleared() = 0;
+ };
+
LogBuffer();
~LogBuffer();
// Returns the global instance.
static LogBuffer* GetInstance();
+ // Adds and removes log buffer observers.
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
// Adds a new log message to the buffer. If the number of log messages exceeds
// the maximum, then the earliest added log will be removed.
void AddLogMessage(const LogMessage& log_message);
@@ -56,6 +70,9 @@ class LogBuffer {
// The messages currently in the buffer.
std::list<LogMessage> log_messages_;
+ // List of observers.
+ ObserverList<Observer> observers_;
+
DISALLOW_COPY_AND_ASSIGN(LogBuffer);
};
« no previous file with comments | « no previous file | components/proximity_auth/logging/log_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698