1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_BUG_REPORT_DATA_H_ 6 #define CHROME_BROWSER_BUG_REPORT_DATA_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "base/utf_string_conversions.h" 12 #include "chrome/browser/bug_report_util.h" 13 14 #if defined(OS_CHROMEOS) 15 #include "chrome/browser/chromeos/cros/syslogs_library.h" 16 #endif 17 18 class BugReportData { 19 public: 20 // Make sure we initialize these flags to false since SyslogsComplete 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 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 25 // sys_info and zip_content fields and exit without disturbing anything else 26 BugReportData(); 27 ~BugReportData(); 28 29 // Defined in bug_report_ui.cc 30 void SendReport(); 31 32 void UpdateData(Profile* profile, 33 const std::string& target_tab_url, 34 const int problem_type, 35 const std::string& page_url, 36 const std::string& description, 37 const std::vector<unsigned char>& image 38 #if defined(OS_CHROMEOS) 39 , const std::string& user_email 40 , const bool send_sys_info 41 , const bool sent_report 42 #endif 43 ); 44 45 #if defined(OS_CHROMEOS) 46 void SyslogsComplete(chromeos::LogDictionaryType* logs, 47 std::string* zip_content); 48 #endif 49 target_tab_url()50 const std::string& target_tab_url() const { return target_tab_url_; } 51 problem_type()52 int problem_type() const { return problem_type_; } page_url()53 const std::string& page_url() const { return page_url_; } description()54 const std::string& description() const { return description_; } image()55 const std::vector<unsigned char>& image() const { return image_; } 56 #if defined(OS_CHROMEOS) user_email()57 const std::string& user_email() const { return user_email_; } sys_info()58 chromeos::LogDictionaryType* sys_info() const { return sys_info_; } send_sys_info()59 bool send_sys_info() const { return send_sys_info_; } sent_report()60 bool sent_report() const { return sent_report_; } zip_content()61 std::string* zip_content() const { return zip_content_; } 62 #endif 63 64 65 private: 66 Profile* profile_; 67 68 // Target tab url. 69 std::string target_tab_url_; 70 71 int problem_type_; 72 std::string page_url_; 73 std::string description_; 74 std::vector<unsigned char> image_; 75 76 #if defined(OS_CHROMEOS) 77 // Chromeos specific values for SendReport. 78 std::string user_email_; 79 chromeos::LogDictionaryType* sys_info_; 80 // Content of the compressed system logs. 81 std::string* zip_content_; 82 // NOTE: Extra boolean sent_report_ is required because callback may 83 // occur before or after we call SendReport(). 84 bool sent_report_; 85 // Flag to indicate to SyslogsComplete that it should send the report 86 bool send_sys_info_; 87 #endif 88 }; 89 90 #endif // CHROME_BROWSER_BUG_REPORT_DATA_H_ 91