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

Side by Side 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: self revision 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/feedback_private/feedback_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/extensions/blob_reader.h" 16 #include "chrome/browser/extensions/blob_reader.h"
16 #include "chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.h" 17 #include "chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.h"
17 #include "chrome/common/extensions/api/feedback_private.h" 18 #include "chrome/common/extensions/api/feedback_private.h"
18 #include "components/feedback/feedback_data.h" 19 #include "components/feedback/feedback_data.h"
19 20
20 class Profile; 21 class Profile;
21 22
22 using extensions::api::feedback_private::SystemInformation; 23 using extensions::api::feedback_private::SystemInformation;
23 24
24 namespace extensions { 25 namespace extensions {
25 26
26 typedef std::vector<linked_ptr<SystemInformation> > SystemInformationList; 27 using SystemInformationList = std::vector<linked_ptr<SystemInformation>>;
27 28
28 // The feedback service provides the ability to gather the various pieces of 29 // The feedback service provides the ability to gather the various pieces of
29 // data needed to send a feedback report and then send the report once all 30 // data needed to send a feedback report and then send the report once all
30 // the pieces are available. 31 // the pieces are available.
31 class FeedbackService : public base::SupportsWeakPtr<FeedbackService> { 32 class FeedbackService : public base::SupportsWeakPtr<FeedbackService> {
32 public: 33 public:
33 typedef base::Callback<void(bool)> SendFeedbackCallback; 34 using SendFeedbackCallback = base::Callback<void(bool)>;
34 typedef base::Callback<void(const SystemInformationList& sys_info)> 35 using GetSystemInformationCallback =
35 GetSystemInformationCallback; 36 base::Callback<void(const SystemInformationList&)>;
36 37
37 FeedbackService(); 38 FeedbackService();
38 virtual ~FeedbackService(); 39 virtual ~FeedbackService();
39 40
40 // Sends a feedback report. 41 // Sends a feedback report.
41 void SendFeedback(Profile* profile, 42 void SendFeedback(Profile* profile,
42 scoped_refptr<feedback::FeedbackData> feedback_data, 43 scoped_refptr<feedback::FeedbackData> feedback_data,
43 const SendFeedbackCallback& callback); 44 const SendFeedbackCallback& callback);
44 45
45 // Start to gather system information. 46 // Start to gather system information.
46 // The |callback| will be invoked once the query is completed. 47 // The |callback| will be invoked once the query is completed.
47 void GetSystemInformation(const GetSystemInformationCallback& callback); 48 void GetSystemInformation(const GetSystemInformationCallback& callback);
48 49
49 private: 50 private:
50 // Callbacks to receive blob data. 51 // Callbacks to receive blob data.
51 void AttachedFileCallback(scoped_ptr<std::string> data, 52 void AttachedFileCallback(scoped_refptr<feedback::FeedbackData> feedback_data,
53 const SendFeedbackCallback& callback,
54 scoped_ptr<std::string> data,
52 int64_t total_blob_length); 55 int64_t total_blob_length);
53 void ScreenshotCallback(scoped_ptr<std::string> data, 56 void ScreenshotCallback(scoped_refptr<feedback::FeedbackData> feedback_data,
57 const SendFeedbackCallback& callback,
58 scoped_ptr<std::string> data,
54 int64_t total_blob_length); 59 int64_t total_blob_length);
55 60
61 void OnSystemLogsFetchComplete(
62 const GetSystemInformationCallback& callback,
63 scoped_ptr<system_logs::SystemLogsResponse> sys_info);
64
56 // Checks if we have read all the blobs we need to; signals the feedback 65 // Checks if we have read all the blobs we need to; signals the feedback
57 // data object once all the requisite data has been populated. 66 // data object once all the requisite data has been populated.
58 void CompleteSendFeedback(); 67 void CompleteSendFeedback(scoped_refptr<feedback::FeedbackData> feedback_data,
59 68 const SendFeedbackCallback& callback);
60 void OnSystemLogsFetchComplete(
61 scoped_ptr<system_logs::SystemLogsResponse> sys_info);
62
63 GetSystemInformationCallback system_information_callback_;
64 SendFeedbackCallback send_feedback_callback_;
65
66 scoped_refptr<feedback::FeedbackData> feedback_data_;
67 69
68 DISALLOW_COPY_AND_ASSIGN(FeedbackService); 70 DISALLOW_COPY_AND_ASSIGN(FeedbackService);
69 }; 71 };
70 72
71 } // namespace extensions 73 } // namespace extensions
72 74
73 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ 75 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/feedback_private/feedback_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698