OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FEEDBACK_FEEDBACK_DATA_H_ | 5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ |
6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ | 6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "chrome/browser/ui/webui/screenshot_source.h" | 12 #include "chrome/browser/ui/webui/screenshot_source.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
16 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" | 16 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" |
17 #endif | 17 #endif |
18 | 18 |
19 class Profile; | 19 class Profile; |
| 20 #if defined(OS_CHROMEOS) |
| 21 namespace base { |
| 22 class RefCountedString; |
| 23 } |
| 24 #endif |
20 | 25 |
21 class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { | 26 class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { |
22 public: | 27 public: |
23 FeedbackData(); | 28 FeedbackData(); |
24 | 29 |
25 // Called once we've update all the data from the feedback page. | 30 // Called once we've update all the data from the feedback page. |
26 void FeedbackPageDataComplete(); | 31 void FeedbackPageDataComplete(); |
27 | 32 |
28 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
29 // Called once we have read our system logs. | 34 // Called once we have read our system logs. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const std::string& user_email() const { return user_email_; } | 67 const std::string& user_email() const { return user_email_; } |
63 ScreenshotDataPtr image() const { return image_; } | 68 ScreenshotDataPtr image() const { return image_; } |
64 const std::string attached_filename() const { return attached_filename_; } | 69 const std::string attached_filename() const { return attached_filename_; } |
65 const GURL attached_file_url() const { return attached_file_url_; } | 70 const GURL attached_file_url() const { return attached_file_url_; } |
66 std::string* attached_filedata() const { return attached_filedata_.get(); } | 71 std::string* attached_filedata() const { return attached_filedata_.get(); } |
67 const GURL screenshot_url() const { return screenshot_url_; } | 72 const GURL screenshot_url() const { return screenshot_url_; } |
68 #if defined(OS_CHROMEOS) | 73 #if defined(OS_CHROMEOS) |
69 chromeos::SystemLogsResponse* sys_info() const { | 74 chromeos::SystemLogsResponse* sys_info() const { |
70 return send_sys_info_ ? sys_info_.get() : NULL; | 75 return send_sys_info_ ? sys_info_.get() : NULL; |
71 } | 76 } |
| 77 const int trace_id() const { return trace_id_; } |
72 const std::string timestamp() const { return timestamp_; } | 78 const std::string timestamp() const { return timestamp_; } |
73 std::string* compressed_logs() const { return compressed_logs_.get(); } | 79 std::string* compressed_logs() const { return compressed_logs_.get(); } |
74 #endif | 80 #endif |
75 | 81 |
76 // Setters | 82 // Setters |
77 void set_profile(Profile* profile) { profile_ = profile; } | 83 void set_profile(Profile* profile) { profile_ = profile; } |
78 void set_category_tag(const std::string& category_tag) { | 84 void set_category_tag(const std::string& category_tag) { |
79 category_tag_ = category_tag; | 85 category_tag_ = category_tag; |
80 } | 86 } |
81 void set_page_url(const std::string& page_url) { page_url_ = page_url; } | 87 void set_page_url(const std::string& page_url) { page_url_ = page_url; } |
82 void set_description(const std::string& description) { | 88 void set_description(const std::string& description) { |
83 description_ = description; | 89 description_ = description; |
84 } | 90 } |
85 void set_user_email(const std::string& user_email) { | 91 void set_user_email(const std::string& user_email) { |
86 user_email_ = user_email; | 92 user_email_ = user_email; |
87 } | 93 } |
88 void set_image(ScreenshotDataPtr image) { image_ = image; } | 94 void set_image(ScreenshotDataPtr image) { image_ = image; } |
89 void set_attached_filename(const std::string& attached_filename) { | 95 void set_attached_filename(const std::string& attached_filename) { |
90 attached_filename_ = attached_filename; | 96 attached_filename_ = attached_filename; |
91 } | 97 } |
92 void set_attached_filedata(scoped_ptr<std::string> attached_filedata) { | 98 void set_attached_filedata(scoped_ptr<std::string> attached_filedata) { |
93 attached_filedata_ = attached_filedata.Pass(); | 99 attached_filedata_ = attached_filedata.Pass(); |
94 } | 100 } |
95 void set_attached_file_url(const GURL& url) { attached_file_url_ = url; } | 101 void set_attached_file_url(const GURL& url) { attached_file_url_ = url; } |
96 void set_screenshot_url(const GURL& url) { screenshot_url_ = url; } | 102 void set_screenshot_url(const GURL& url) { screenshot_url_ = url; } |
97 #if defined(OS_CHROMEOS) | 103 #if defined(OS_CHROMEOS) |
98 void set_sys_info(scoped_ptr<chromeos::SystemLogsResponse> sys_info); | 104 void set_sys_info(scoped_ptr<chromeos::SystemLogsResponse> sys_info); |
| 105 void set_trace_id(int trace_id) { trace_id_ = trace_id; } |
99 void set_send_sys_info(bool send_sys_info) { send_sys_info_ = send_sys_info; } | 106 void set_send_sys_info(bool send_sys_info) { send_sys_info_ = send_sys_info; } |
100 void set_timestamp(const std::string& timestamp) { | 107 void set_timestamp(const std::string& timestamp) { |
101 timestamp_ = timestamp; | 108 timestamp_ = timestamp; |
102 } | 109 } |
103 #endif | 110 #endif |
104 | 111 |
105 private: | 112 private: |
106 friend class base::RefCountedThreadSafe<FeedbackData>; | 113 friend class base::RefCountedThreadSafe<FeedbackData>; |
107 | 114 |
108 virtual ~FeedbackData(); | 115 virtual ~FeedbackData(); |
109 | 116 |
110 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
111 void ReadAttachedFile(const base::FilePath& from); | 118 void ReadAttachedFile(const base::FilePath& from); |
| 119 void OnGetTraceData(scoped_refptr<base::RefCountedString> trace_data); |
112 #endif | 120 #endif |
113 | 121 |
114 Profile* profile_; | 122 Profile* profile_; |
115 | 123 |
116 std::string category_tag_; | 124 std::string category_tag_; |
117 std::string page_url_; | 125 std::string page_url_; |
118 std::string description_; | 126 std::string description_; |
119 std::string user_email_; | 127 std::string user_email_; |
120 ScreenshotDataPtr image_; | 128 ScreenshotDataPtr image_; |
121 std::string attached_filename_; | 129 std::string attached_filename_; |
122 scoped_ptr<std::string> attached_filedata_; | 130 scoped_ptr<std::string> attached_filedata_; |
123 | 131 |
124 GURL attached_file_url_; | 132 GURL attached_file_url_; |
125 GURL screenshot_url_; | 133 GURL screenshot_url_; |
126 | 134 |
127 #if defined(OS_CHROMEOS) | 135 #if defined(OS_CHROMEOS) |
128 // Chromeos specific values for SendReport. Will be deleted in | 136 // Chromeos specific values for SendReport. Will be deleted in |
129 // feedback_util::SendReport once consumed or in SyslogsComplete if | 137 // feedback_util::SendReport once consumed or in SyslogsComplete if |
130 // we don't send the logs with the report. | 138 // we don't send the logs with the report. |
131 scoped_ptr<chromeos::SystemLogsResponse> sys_info_; | 139 scoped_ptr<chromeos::SystemLogsResponse> sys_info_; |
132 | 140 |
| 141 int trace_id_; |
133 std::string timestamp_; | 142 std::string timestamp_; |
134 scoped_ptr<std::string> compressed_logs_; | 143 scoped_ptr<std::string> compressed_logs_; |
135 | 144 |
136 // Flag to indicate whether or not we should send the system information | 145 // Flag to indicate whether or not we should send the system information |
137 // gathered with the report or not. | 146 // gathered with the report or not. |
138 bool send_sys_info_; | 147 bool send_sys_info_; |
139 | 148 |
140 // Flags to indicate if various pieces of data needed for the report have | 149 // Flags to indicate if various pieces of data needed for the report have |
141 // been collected yet or are still pending collection. | 150 // been collected yet or are still pending collection. |
142 bool read_attached_file_complete_; | 151 bool read_attached_file_complete_; |
143 bool syslogs_collection_complete_; | 152 bool syslogs_collection_complete_; |
144 #endif | 153 #endif |
145 bool feedback_page_data_complete_; | 154 bool feedback_page_data_complete_; |
146 | 155 |
147 DISALLOW_COPY_AND_ASSIGN(FeedbackData); | 156 DISALLOW_COPY_AND_ASSIGN(FeedbackData); |
148 }; | 157 }; |
149 | 158 |
150 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ | 159 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ |
OLD | NEW |