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

Unified Diff: chrome/browser/extensions/api/feedback_private/feedback_service.h

Issue 1794513002: Fix sending multiple feedback reports within short durations of each other (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Xiyuan's comments Created 4 years, 9 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/extensions/api/feedback_private/feedback_service.h
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_service.h b/chrome/browser/extensions/api/feedback_private/feedback_service.h
index 9588c534d61988e998a1891e2c48cd892218f9d0..f3fa8b048f6e51da57283a16d4be2a2e9178364d 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_service.h
+++ b/chrome/browser/extensions/api/feedback_private/feedback_service.h
@@ -7,7 +7,9 @@
#include <stdint.h>
+#include <map>
#include <vector>
+
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
@@ -30,9 +32,10 @@ typedef std::vector<linked_ptr<SystemInformation> > SystemInformationList;
// the pieces are available.
class FeedbackService : public base::SupportsWeakPtr<FeedbackService> {
public:
- typedef base::Callback<void(bool)> SendFeedbackCallback;
- typedef base::Callback<void(const SystemInformationList& sys_info)>
- GetSystemInformationCallback;
+ using RequestId = int64_t;
+ using SendFeedbackCallback = base::Callback<void(bool)>;
+ using GetSystemInformationCallback =
+ base::Callback<void(const SystemInformationList& sys_info)>;
FeedbackService();
virtual ~FeedbackService();
@@ -47,23 +50,25 @@ class FeedbackService : public base::SupportsWeakPtr<FeedbackService> {
void GetSystemInformation(const GetSystemInformationCallback& callback);
private:
+ struct SendRequest;
+
// Callbacks to receive blob data.
- void AttachedFileCallback(scoped_ptr<std::string> data,
+ void AttachedFileCallback(RequestId request_id,
+ scoped_ptr<std::string> data,
int64_t total_blob_length);
- void ScreenshotCallback(scoped_ptr<std::string> data,
+ void ScreenshotCallback(RequestId request_id,
+ scoped_ptr<std::string> data,
int64_t total_blob_length);
- // Checks if we have read all the blobs we need to; signals the feedback
- // data object once all the requisite data has been populated.
- void CompleteSendFeedback();
-
void OnSystemLogsFetchComplete(
+ const GetSystemInformationCallback& callback,
scoped_ptr<system_logs::SystemLogsResponse> sys_info);
- GetSystemInformationCallback system_information_callback_;
- SendFeedbackCallback send_feedback_callback_;
+ // Checks if we have read all the blobs we need to; signals the feedback
+ // data object once all the requisite data has been populated.
+ void CompleteSendFeedback(RequestId request_id);
- scoped_refptr<feedback::FeedbackData> feedback_data_;
+ std::map<RequestId, SendRequest> send_feedback_requests_;
DISALLOW_COPY_AND_ASSIGN(FeedbackService);
};

Powered by Google App Engine
This is Rietveld 408576698