blob: 33b3cee2851633f190c60be354458426dfcc4e17 [file] [log] [blame]
[email protected]1eab4e92014-05-09 02:17:191// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]aa20e062010-12-07 23:07:272// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
[email protected]43461682010-10-29 00:52:364
[email protected]1eab4e92014-05-09 02:17:195#ifndef COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_
6#define COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_
[email protected]43461682010-10-29 00:52:367
dcheng84c358e2016-04-26 07:05:538#include <memory>
[email protected]43461682010-10-29 00:52:369#include <string>
[email protected]43461682010-10-29 00:52:3610
[email protected]42066d52014-06-06 17:51:1211#include "base/callback.h"
avibc5337b2015-12-25 23:16:3312#include "base/macros.h"
[email protected]42066d52014-06-06 17:51:1213#include "components/feedback/feedback_common.h"
Ahmed Fakhry7ff0cdb2017-08-22 20:11:4514#include "components/feedback/feedback_uploader.h"
[email protected]761fa4702013-07-02 15:25:1515#include "url/gurl.h"
[email protected]43461682010-10-29 00:52:3616
[email protected]3b6ef6a2013-08-10 15:40:5817namespace base {
[email protected]535e6982013-09-23 23:58:4918class RefCountedString;
[email protected]3b6ef6a2013-08-10 15:40:5819}
[email protected]1eab4e92014-05-09 02:17:1920namespace content {
21class BrowserContext;
22}
23
24namespace feedback {
[email protected]9bb480ee2011-08-03 21:41:1625
[email protected]42066d52014-06-06 17:51:1226class FeedbackData : public FeedbackCommon {
[email protected]43461682010-10-29 00:52:3627 public:
Ahmed Fakhry7ff0cdb2017-08-22 20:11:4528 FeedbackData(feedback::FeedbackUploader* uploader);
[email protected]67e2d0f2013-03-19 22:36:4229
[email protected]54736e32013-09-07 02:53:1930 // Called once we've updated all the data from the feedback page.
[email protected]30e4f872013-08-17 13:54:4731 void OnFeedbackPageDataComplete();
[email protected]67e2d0f2013-03-19 22:36:4232
Chris Morin48c80c12019-04-12 19:43:4133 // Kicks off compression of the system information for this instance.
34 void CompressSystemInfo();
[email protected]295683452013-03-22 21:02:5335
Jeffrey Kardatzkef7d95a12019-03-20 22:40:2936 // Sets the histograms for this instance and kicks off its
37 // compression.
Chris Morinc7a03442019-04-03 19:51:1538 void SetAndCompressHistograms(std::string histograms);
Jeffrey Kardatzkef7d95a12019-03-20 22:40:2939
[email protected]9c12a3752013-11-19 12:04:1740 // Sets the attached file data and kicks off its compression.
Chris Morinc7a03442019-04-03 19:51:1541 void AttachAndCompressFileData(std::string attached_filedata);
[email protected]6730355e2013-10-23 06:48:5642
[email protected]30e4f872013-08-17 13:54:4743 // 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]43461682010-10-29 00:52:3647
[email protected]67e2d0f2013-03-19 22:36:4248 // Sends the feedback report if we have all our data complete.
[email protected]43461682010-10-29 00:52:3649 void SendReport();
50
[email protected]67e2d0f2013-03-19 22:36:4251 // Getters
[email protected]1eab4e92014-05-09 02:17:1952 content::BrowserContext* context() const { return context_; }
[email protected]62bd6b12014-07-14 20:58:3353 const std::string& attached_file_uuid() const { return attached_file_uuid_; }
54 const std::string& screenshot_uuid() const { return screenshot_uuid_; }
Xiao Yangc2a0a392019-02-03 03:33:5455 bool from_assistant() const { return from_assistant_; }
56 bool assistant_debug_info_allowed() const {
57 return assistant_debug_info_allowed_;
58 }
[email protected]43461682010-10-29 00:52:3659
[email protected]67e2d0f2013-03-19 22:36:4260 // Setters
[email protected]1eab4e92014-05-09 02:17:1961 void set_context(content::BrowserContext* context) { context_ = context; }
[email protected]67e2d0f2013-03-19 22:36:4262 void set_attached_filename(const std::string& attached_filename) {
63 attached_filename_ = attached_filename;
64 }
[email protected]2d681912013-09-24 04:59:5565 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]535e6982013-09-23 23:58:4971 void set_trace_id(int trace_id) { trace_id_ = trace_id; }
Xiao Yangc2a0a392019-02-03 03:33:5472 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]43461682010-10-29 00:52:3678
79 private:
dcheng00ea022b2014-10-21 11:24:5680 ~FeedbackData() override;
[email protected]a760c3b62014-03-19 20:51:5081
[email protected]42066d52014-06-06 17:51:1282 // Called once a compression operation is complete.
83 void OnCompressComplete();
84
[email protected]5fbdc5f52013-10-13 18:31:5685 void OnGetTraceData(int trace_id,
86 scoped_refptr<base::RefCountedString> trace_data);
[email protected]535e6982013-09-23 23:58:4987
Ahmed Fakhry7ff0cdb2017-08-22 20:11:4588 feedback::FeedbackUploader* uploader_; // Not owned.
[email protected]42066d52014-06-06 17:51:1289
[email protected]1eab4e92014-05-09 02:17:1990 content::BrowserContext* context_;
[email protected]43461682010-10-29 00:52:3691
[email protected]4d6f38f2013-06-18 11:09:5892 std::string attached_filename_;
[email protected]2d681912013-09-24 04:59:5593 std::string attached_file_uuid_;
94 std::string screenshot_uuid_;
[email protected]43461682010-10-29 00:52:3695
[email protected]535e6982013-09-23 23:58:4996 int trace_id_;
97
[email protected]42066d52014-06-06 17:51:1298 int pending_op_count_;
[email protected]30e4f872013-08-17 13:54:4799 bool report_sent_;
Xiao Yangc2a0a392019-02-03 03:33:54100 bool from_assistant_;
101 bool assistant_debug_info_allowed_;
[email protected]67e2d0f2013-03-19 22:36:42102
103 DISALLOW_COPY_AND_ASSIGN(FeedbackData);
[email protected]43461682010-10-29 00:52:36104};
105
[email protected]1eab4e92014-05-09 02:17:19106} // namespace feedback
107
108#endif // COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_