OLD | NEW |
1 // Copyright 2010 Google Inc. All Rights Reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Author: rkc@google.com (Rahul Chaturvedi) | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
3 | 4 |
4 #ifndef CHROME_BROWSER_BUG_REPORT_DATA_H_ | 5 #ifndef CHROME_BROWSER_BUG_REPORT_DATA_H_ |
5 #define CHROME_BROWSER_BUG_REPORT_DATA_H_ | 6 #define CHROME_BROWSER_BUG_REPORT_DATA_H_ |
6 | 7 |
7 | |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/bug_report_util.h" | 12 #include "chrome/browser/bug_report_util.h" |
13 | 13 |
14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
15 #include "chrome/browser/chromeos/cros/syslogs_library.h" | 15 #include "chrome/browser/chromeos/cros/syslogs_library.h" |
16 #endif | 16 #endif |
17 | 17 |
18 class BugReportData { | 18 class BugReportData { |
19 public: | 19 public: |
20 // Make sure we initialize these flags to false since SyslogsComplete | 20 // Make sure we initialize these flags to false since SyslogsComplete |
21 // may be triggered before we've called update data; in which case, | 21 // may be triggered before we've called update data; in which case, |
22 // we do not want it to just delete the logs it just gathered, and we | 22 // we do not want it to just delete the logs it just gathered, and we |
23 // don't want it to send the report either - this will make sure that if | 23 // don't want it to send the report either - this will make sure that if |
24 // SyslogsComplete gets called before UpdateData, we'll simply populate the | 24 // SyslogsComplete gets called before UpdateData, we'll simply populate the |
25 // sys_info and zip_content fields and exit without disturbing anything else | 25 // sys_info and zip_content fields and exit without disturbing anything else |
26 BugReportData() : profile_(NULL), | 26 BugReportData(); |
27 problem_type_(0) | 27 ~BugReportData(); |
28 #if defined(OS_CHROMEOS) | |
29 , sent_report_(false), send_sys_info_(false) | |
30 #endif | |
31 { | |
32 } | |
33 | 28 |
34 // Defined in bug_report_ui.cc | 29 // Defined in bug_report_ui.cc |
35 void SendReport(); | 30 void SendReport(); |
36 | 31 |
37 void UpdateData(Profile* profile | 32 void UpdateData(Profile* profile, |
38 , const std::string& target_tab_url | 33 const std::string& target_tab_url, |
39 , const string16& target_tab_title | 34 const string16& target_tab_title, |
40 , const int problem_type | 35 const int problem_type, |
41 , const std::string& page_url | 36 const std::string& page_url, |
42 , const std::string& description | 37 const std::string& description, |
43 , const std::vector<unsigned char>& image | 38 const std::vector<unsigned char>& image |
44 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
45 , const std::string& user_email | 40 , const std::string& user_email |
46 , const bool send_sys_info | 41 , const bool send_sys_info |
47 , const bool sent_report | 42 , const bool sent_report |
48 #endif | 43 #endif |
49 ) { | 44 ); |
50 profile_ = profile; | |
51 target_tab_url_ = target_tab_url; | |
52 target_tab_title_ = target_tab_title; | |
53 problem_type_ = problem_type; | |
54 page_url_ = page_url; | |
55 description_ = description; | |
56 image_ = image; | |
57 #if defined(OS_CHROMEOS) | |
58 user_email_ = user_email; | |
59 send_sys_info_ = send_sys_info; | |
60 sent_report_ = sent_report; | |
61 #endif | |
62 } | |
63 | 45 |
64 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
65 void SyslogsComplete(chromeos::LogDictionaryType* logs, | 47 void SyslogsComplete(chromeos::LogDictionaryType* logs, |
66 std::string* zip_content); | 48 std::string* zip_content); |
67 #endif | 49 #endif |
68 | 50 |
69 const std::string& target_tab_url() { return target_tab_url_; } | 51 const std::string& target_tab_url() { return target_tab_url_; } |
70 const string16& target_tab_title() { return target_tab_title_; } | 52 const string16& target_tab_title() { return target_tab_title_; } |
71 | 53 |
72 int problem_type() { return problem_type_; } | 54 int problem_type() { return problem_type_; } |
(...skipping 30 matching lines...) Expand all Loading... |
103 std::string* zip_content_; | 85 std::string* zip_content_; |
104 // NOTE: Extra boolean sent_report_ is required because callback may | 86 // NOTE: Extra boolean sent_report_ is required because callback may |
105 // occur before or after we call SendReport(). | 87 // occur before or after we call SendReport(). |
106 bool sent_report_; | 88 bool sent_report_; |
107 // Flag to indicate to SyslogsComplete that it should send the report | 89 // Flag to indicate to SyslogsComplete that it should send the report |
108 bool send_sys_info_; | 90 bool send_sys_info_; |
109 #endif | 91 #endif |
110 }; | 92 }; |
111 | 93 |
112 #endif // CHROME_BROWSER_BUG_REPORT_DATA_H_ | 94 #endif // CHROME_BROWSER_BUG_REPORT_DATA_H_ |
OLD | NEW |