[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | aa20e06 | 2010-12-07 23:07:27 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 4 | |
[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 5 | #ifndef COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_ |
6 | #define COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_ | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 7 | |
dcheng | 84c358e | 2016-04-26 07:05:53 | [diff] [blame] | 8 | #include <memory> |
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 9 | #include <string> |
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 10 | |
[email protected] | 42066d5 | 2014-06-06 17:51:12 | [diff] [blame] | 11 | #include "base/callback.h" |
avi | bc5337b | 2015-12-25 23:16:33 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | 42066d5 | 2014-06-06 17:51:12 | [diff] [blame] | 13 | #include "components/feedback/feedback_common.h" |
Ahmed Fakhry | 7ff0cdb | 2017-08-22 20:11:45 | [diff] [blame] | 14 | #include "components/feedback/feedback_uploader.h" |
[email protected] | 761fa470 | 2013-07-02 15:25:15 | [diff] [blame] | 15 | #include "url/gurl.h" |
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 16 | |
[email protected] | 3b6ef6a | 2013-08-10 15:40:58 | [diff] [blame] | 17 | namespace base { |
[email protected] | 535e698 | 2013-09-23 23:58:49 | [diff] [blame] | 18 | class RefCountedString; |
[email protected] | 3b6ef6a | 2013-08-10 15:40:58 | [diff] [blame] | 19 | } |
[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 20 | namespace content { |
21 | class BrowserContext; | ||||
22 | } | ||||
23 | |||||
24 | namespace feedback { | ||||
[email protected] | 9bb480ee | 2011-08-03 21:41:16 | [diff] [blame] | 25 | |
[email protected] | 42066d5 | 2014-06-06 17:51:12 | [diff] [blame] | 26 | class FeedbackData : public FeedbackCommon { |
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 27 | public: |
Ahmed Fakhry | 7ff0cdb | 2017-08-22 20:11:45 | [diff] [blame] | 28 | FeedbackData(feedback::FeedbackUploader* uploader); |
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 29 | |
[email protected] | 54736e3 | 2013-09-07 02:53:19 | [diff] [blame] | 30 | // Called once we've updated all the data from the feedback page. |
[email protected] | 30e4f87 | 2013-08-17 13:54:47 | [diff] [blame] | 31 | void OnFeedbackPageDataComplete(); |
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 32 | |
Chris Morin | 48c80c1 | 2019-04-12 19:43:41 | [diff] [blame] | 33 | // Kicks off compression of the system information for this instance. |
34 | void CompressSystemInfo(); | ||||
[email protected] | 29568345 | 2013-03-22 21:02:53 | [diff] [blame] | 35 | |
Jeffrey Kardatzke | f7d95a1 | 2019-03-20 22:40:29 | [diff] [blame] | 36 | // Sets the histograms for this instance and kicks off its |
37 | // compression. | ||||
Chris Morin | c7a0344 | 2019-04-03 19:51:15 | [diff] [blame] | 38 | void SetAndCompressHistograms(std::string histograms); |
Jeffrey Kardatzke | f7d95a1 | 2019-03-20 22:40:29 | [diff] [blame] | 39 | |
[email protected] | 9c12a375 | 2013-11-19 12:04:17 | [diff] [blame] | 40 | // Sets the attached file data and kicks off its compression. |
Chris Morin | c7a0344 | 2019-04-03 19:51:15 | [diff] [blame] | 41 | void AttachAndCompressFileData(std::string attached_filedata); |
[email protected] | 6730355e | 2013-10-23 06:48:56 | [diff] [blame] | 42 | |
[email protected] | 30e4f87 | 2013-08-17 13:54:47 | [diff] [blame] | 43 | // Returns true if we've completed all the tasks needed before we can send |
44 | // feedback - at this time this is includes getting the feedback page data | ||||
45 | // and compressing the system logs. | ||||
46 | bool IsDataComplete(); | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 47 | |
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 48 | // Sends the feedback report if we have all our data complete. |
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 49 | void SendReport(); |
50 | |||||
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 51 | // Getters |
[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 52 | content::BrowserContext* context() const { return context_; } |
[email protected] | 62bd6b1 | 2014-07-14 20:58:33 | [diff] [blame] | 53 | const std::string& attached_file_uuid() const { return attached_file_uuid_; } |
54 | const std::string& screenshot_uuid() const { return screenshot_uuid_; } | ||||
Xiao Yang | c2a0a39 | 2019-02-03 03:33:54 | [diff] [blame] | 55 | bool from_assistant() const { return from_assistant_; } |
56 | bool assistant_debug_info_allowed() const { | ||||
57 | return assistant_debug_info_allowed_; | ||||
58 | } | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 59 | |
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 60 | // Setters |
[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 61 | void set_context(content::BrowserContext* context) { context_ = context; } |
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 62 | void set_attached_filename(const std::string& attached_filename) { |
63 | attached_filename_ = attached_filename; | ||||
64 | } | ||||
[email protected] | 2d68191 | 2013-09-24 04:59:55 | [diff] [blame] | 65 | void set_attached_file_uuid(const std::string& uuid) { |
66 | attached_file_uuid_ = uuid; | ||||
67 | } | ||||
68 | void set_screenshot_uuid(const std::string& uuid) { | ||||
69 | screenshot_uuid_ = uuid; | ||||
70 | } | ||||
[email protected] | 535e698 | 2013-09-23 23:58:49 | [diff] [blame] | 71 | void set_trace_id(int trace_id) { trace_id_ = trace_id; } |
Xiao Yang | c2a0a39 | 2019-02-03 03:33:54 | [diff] [blame] | 72 | void set_from_assistant(bool from_assistant) { |
73 | from_assistant_ = from_assistant; | ||||
74 | } | ||||
75 | void set_assistant_debug_info_allowed(bool assistant_debug_info_allowed) { | ||||
76 | assistant_debug_info_allowed_ = assistant_debug_info_allowed; | ||||
77 | } | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 78 | |
79 | private: | ||||
dcheng | 00ea022b | 2014-10-21 11:24:56 | [diff] [blame] | 80 | ~FeedbackData() override; |
[email protected] | a760c3b6 | 2014-03-19 20:51:50 | [diff] [blame] | 81 | |
[email protected] | 42066d5 | 2014-06-06 17:51:12 | [diff] [blame] | 82 | // Called once a compression operation is complete. |
83 | void OnCompressComplete(); | ||||
84 | |||||
[email protected] | 5fbdc5f5 | 2013-10-13 18:31:56 | [diff] [blame] | 85 | void OnGetTraceData(int trace_id, |
86 | scoped_refptr<base::RefCountedString> trace_data); | ||||
[email protected] | 535e698 | 2013-09-23 23:58:49 | [diff] [blame] | 87 | |
Ahmed Fakhry | 7ff0cdb | 2017-08-22 20:11:45 | [diff] [blame] | 88 | feedback::FeedbackUploader* uploader_; // Not owned. |
[email protected] | 42066d5 | 2014-06-06 17:51:12 | [diff] [blame] | 89 | |
[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 90 | content::BrowserContext* context_; |
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 91 | |
[email protected] | 4d6f38f | 2013-06-18 11:09:58 | [diff] [blame] | 92 | std::string attached_filename_; |
[email protected] | 2d68191 | 2013-09-24 04:59:55 | [diff] [blame] | 93 | std::string attached_file_uuid_; |
94 | std::string screenshot_uuid_; | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 95 | |
[email protected] | 535e698 | 2013-09-23 23:58:49 | [diff] [blame] | 96 | int trace_id_; |
97 | |||||
[email protected] | 42066d5 | 2014-06-06 17:51:12 | [diff] [blame] | 98 | int pending_op_count_; |
[email protected] | 30e4f87 | 2013-08-17 13:54:47 | [diff] [blame] | 99 | bool report_sent_; |
Xiao Yang | c2a0a39 | 2019-02-03 03:33:54 | [diff] [blame] | 100 | bool from_assistant_; |
101 | bool assistant_debug_info_allowed_; | ||||
[email protected] | 67e2d0f | 2013-03-19 22:36:42 | [diff] [blame] | 102 | |
103 | DISALLOW_COPY_AND_ASSIGN(FeedbackData); | ||||
[email protected] | 4346168 | 2010-10-29 00:52:36 | [diff] [blame] | 104 | }; |
105 | |||||
[email protected] | 1eab4e9 | 2014-05-09 02:17:19 | [diff] [blame] | 106 | } // namespace feedback |
107 | |||||
108 | #endif // COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_ |