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 "googleurl/src/gurl.h" |
13 | 14 |
14 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
15 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" | 16 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" |
16 #endif | 17 #endif |
17 | 18 |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { | 21 class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { |
21 public: | 22 public: |
22 FeedbackData(); | 23 FeedbackData(); |
(...skipping 30 matching lines...) Expand all Loading... |
53 // file_data. ReadFileComplete is called once this is done. | 54 // file_data. ReadFileComplete is called once this is done. |
54 void StartReadFile(const std::string filename, const std::string* file_data); | 55 void StartReadFile(const std::string filename, const std::string* file_data); |
55 | 56 |
56 // Getters | 57 // Getters |
57 Profile* profile() const { return profile_; } | 58 Profile* profile() const { return profile_; } |
58 const std::string& category_tag() const { return category_tag_; } | 59 const std::string& category_tag() const { return category_tag_; } |
59 const std::string& page_url() const { return page_url_; } | 60 const std::string& page_url() const { return page_url_; } |
60 const std::string& description() const { return description_; } | 61 const std::string& description() const { return description_; } |
61 const std::string& user_email() const { return user_email_; } | 62 const std::string& user_email() const { return user_email_; } |
62 ScreenshotDataPtr image() const { return image_; } | 63 ScreenshotDataPtr image() const { return image_; } |
| 64 const std::string attached_filename() const { return attached_filename_; } |
| 65 const GURL attached_file_url() const { return attached_file_url_; } |
| 66 std::string* attached_filedata() const { return attached_filedata_.get(); } |
| 67 const GURL screenshot_url() const { return screenshot_url_; } |
63 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
64 chromeos::SystemLogsResponse* sys_info() const { | 69 chromeos::SystemLogsResponse* sys_info() const { |
65 return send_sys_info_ ? sys_info_.get() : NULL; | 70 return send_sys_info_ ? sys_info_.get() : NULL; |
66 } | 71 } |
67 const std::string timestamp() const { return timestamp_; } | 72 const std::string timestamp() const { return timestamp_; } |
68 const std::string attached_filename() const { return attached_filename_; } | |
69 std::string* attached_filedata() const { return attached_filedata_.get(); } | |
70 std::string* compressed_logs() const { return compressed_logs_.get(); } | 73 std::string* compressed_logs() const { return compressed_logs_.get(); } |
71 #endif | 74 #endif |
72 | 75 |
73 // Setters | 76 // Setters |
74 void set_profile(Profile* profile) { profile_ = profile; } | 77 void set_profile(Profile* profile) { profile_ = profile; } |
75 void set_category_tag(const std::string& category_tag) { | 78 void set_category_tag(const std::string& category_tag) { |
76 category_tag_ = category_tag; | 79 category_tag_ = category_tag; |
77 } | 80 } |
78 void set_page_url(const std::string& page_url) { page_url_ = page_url; } | 81 void set_page_url(const std::string& page_url) { page_url_ = page_url; } |
79 void set_description(const std::string& description) { | 82 void set_description(const std::string& description) { |
80 description_ = description; | 83 description_ = description; |
81 } | 84 } |
82 void set_user_email(const std::string& user_email) { | 85 void set_user_email(const std::string& user_email) { |
83 user_email_ = user_email; | 86 user_email_ = user_email; |
84 } | 87 } |
85 void set_image(ScreenshotDataPtr image) { image_ = image; } | 88 void set_image(ScreenshotDataPtr image) { image_ = image; } |
86 #if defined(OS_CHROMEOS) | |
87 void set_send_sys_info(bool send_sys_info) { send_sys_info_ = send_sys_info; } | |
88 void set_timestamp(const std::string& timestamp) { | |
89 timestamp_ = timestamp; | |
90 } | |
91 void set_attached_filename(const std::string& attached_filename) { | 89 void set_attached_filename(const std::string& attached_filename) { |
92 attached_filename_ = attached_filename; | 90 attached_filename_ = attached_filename; |
93 } | 91 } |
94 void set_attached_filedata(scoped_ptr<std::string> attached_filedata) { | 92 void set_attached_filedata(scoped_ptr<std::string> attached_filedata) { |
95 attached_filedata_ = attached_filedata.Pass(); | 93 attached_filedata_ = attached_filedata.Pass(); |
96 } | 94 } |
| 95 void set_attached_file_url(const GURL& url) { attached_file_url_ = url; } |
| 96 void set_screenshot_url(const GURL& url) { screenshot_url_ = url; } |
| 97 #if defined(OS_CHROMEOS) |
| 98 void set_sys_info(scoped_ptr<chromeos::SystemLogsResponse> sys_info); |
| 99 void set_send_sys_info(bool send_sys_info) { send_sys_info_ = send_sys_info; } |
| 100 void set_timestamp(const std::string& timestamp) { |
| 101 timestamp_ = timestamp; |
| 102 } |
97 #endif | 103 #endif |
98 | 104 |
99 private: | 105 private: |
100 friend class base::RefCountedThreadSafe<FeedbackData>; | 106 friend class base::RefCountedThreadSafe<FeedbackData>; |
101 | 107 |
102 virtual ~FeedbackData(); | 108 virtual ~FeedbackData(); |
103 | 109 |
104 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
105 void ReadAttachedFile(const base::FilePath& from); | 111 void ReadAttachedFile(const base::FilePath& from); |
106 #endif | 112 #endif |
107 | 113 |
108 Profile* profile_; | 114 Profile* profile_; |
109 | 115 |
110 std::string category_tag_; | 116 std::string category_tag_; |
111 std::string page_url_; | 117 std::string page_url_; |
112 std::string description_; | 118 std::string description_; |
113 std::string user_email_; | 119 std::string user_email_; |
114 ScreenshotDataPtr image_; | 120 ScreenshotDataPtr image_; |
| 121 std::string attached_filename_; |
| 122 scoped_ptr<std::string> attached_filedata_; |
| 123 |
| 124 GURL attached_file_url_; |
| 125 GURL screenshot_url_; |
115 | 126 |
116 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
117 // Chromeos specific values for SendReport. Will be deleted in | 128 // Chromeos specific values for SendReport. Will be deleted in |
118 // feedback_util::SendReport once consumed or in SyslogsComplete if | 129 // feedback_util::SendReport once consumed or in SyslogsComplete if |
119 // we don't send the logs with the report. | 130 // we don't send the logs with the report. |
120 scoped_ptr<chromeos::SystemLogsResponse> sys_info_; | 131 scoped_ptr<chromeos::SystemLogsResponse> sys_info_; |
121 | 132 |
122 std::string timestamp_; | 133 std::string timestamp_; |
123 std::string attached_filename_; | |
124 scoped_ptr<std::string> attached_filedata_; | |
125 scoped_ptr<std::string> compressed_logs_; | 134 scoped_ptr<std::string> compressed_logs_; |
126 | 135 |
127 // Flag to indicate whether or not we should send the system information | 136 // Flag to indicate whether or not we should send the system information |
128 // gathered with the report or not. | 137 // gathered with the report or not. |
129 bool send_sys_info_; | 138 bool send_sys_info_; |
130 | 139 |
131 // Flags to indicate if various pieces of data needed for the report have | 140 // Flags to indicate if various pieces of data needed for the report have |
132 // been collected yet or are still pending collection. | 141 // been collected yet or are still pending collection. |
133 bool read_attached_file_complete_; | 142 bool read_attached_file_complete_; |
134 bool syslogs_collection_complete_; | 143 bool syslogs_collection_complete_; |
135 #endif | 144 #endif |
136 bool feedback_page_data_complete_; | 145 bool feedback_page_data_complete_; |
137 | 146 |
138 DISALLOW_COPY_AND_ASSIGN(FeedbackData); | 147 DISALLOW_COPY_AND_ASSIGN(FeedbackData); |
139 }; | 148 }; |
140 | 149 |
141 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ | 150 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_ |
OLD | NEW |