Index: components/offline_pages/offline_event_logger.h |
diff --git a/components/offline_pages/offline_event_logger.h b/components/offline_pages/offline_event_logger.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c12e9b6dd0366629a9686da42fa5a9e063c661b6 |
--- /dev/null |
+++ b/components/offline_pages/offline_event_logger.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_EVENT_LOGGER_H_ |
+#define COMPONENTS_OFFLINE_PAGES_OFFLINE_EVENT_LOGGER_H_ |
+ |
+#include <deque> |
+#include <string> |
+#include <vector> |
+ |
+#include "base/macros.h" |
+ |
+namespace offline_pages { |
+ |
+class OfflineEventLogger { |
Pete Williamson
2016/06/24 00:38:32
A class header comment with usage notes would be n
chili
2016/06/24 02:45:51
Done.
|
+ public: |
+ OfflineEventLogger(); |
+ |
+ ~OfflineEventLogger(); |
+ |
+ // Clears the recorded activities. |
+ void Clear(); |
+ |
+ // Turns logging on/off. |
+ void SetIsLogging(bool is_logging); |
+ |
+ // Dumps the current activity list into |records|. |
+ void GetLogs(std::vector<std::string>& records); |
+ |
+ protected: |
+ // Write the activity into the cycling log if we are currently logging. |
+ void RecordActivity(const std::string& activity); |
+ |
+ private: |
+ // Recorded offline page activities. |
+ std::deque<std::string> activities_; |
Pete Williamson
2016/06/24 00:38:32
I like your choice of a deque here, it fits perfec
chili
2016/06/24 02:45:51
Acknowledged. ^_^
|
+ |
+ // Whether we are currently recording logs or not. |
+ bool is_logging_; |
+}; |
+} // namespace offline_pages |
+ |
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_EVENT_LOGGER_H_ |