| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BUG_REPORT_UTIL_H_ | 5 #ifndef CHROME_BROWSER_BUG_REPORT_UTIL_H_ |
| 6 #define CHROME_BROWSER_BUG_REPORT_UTIL_H_ | 6 #define CHROME_BROWSER_BUG_REPORT_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
| 13 #include "base/mac_util.h" | 13 #include "base/mac_util.h" |
| 14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
| 15 #endif | 15 #endif |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 | 17 |
| 18 #include "chrome/browser/userfeedback/proto/common.pb.h" |
| 19 #include "chrome/browser/userfeedback/proto/extension.pb.h" |
| 20 #include "chrome/browser/userfeedback/proto/math.pb.h" |
| 21 #include "gfx/rect.h" |
| 22 |
| 18 class Profile; | 23 class Profile; |
| 19 class TabContents; | 24 class TabContents; |
| 20 | 25 |
| 21 class BugReportUtil { | 26 class BugReportUtil { |
| 22 public: | 27 public: |
| 23 enum BugType { | 28 enum BugType { |
| 24 PAGE_WONT_LOAD = 0, | 29 PAGE_WONT_LOAD = 0, |
| 25 PAGE_LOOKS_ODD, | 30 PAGE_LOOKS_ODD, |
| 26 PHISHING_PAGE, | 31 PHISHING_PAGE, |
| 27 CANT_SIGN_IN, | 32 CANT_SIGN_IN, |
| 28 CHROME_MISBEHAVES, | 33 CHROME_MISBEHAVES, |
| 29 SOMETHING_MISSING, | 34 SOMETHING_MISSING, |
| 30 BROWSER_CRASH, | 35 BROWSER_CRASH, |
| 31 OTHER_PROBLEM | 36 OTHER_PROBLEM |
| 32 }; | 37 }; |
| 33 | 38 |
| 34 // SetOSVersion copies the maj.minor.build + servicePack_string | 39 // SetOSVersion copies the maj.minor.build + servicePack_string |
| 35 // into a string. We currently have: | 40 // into a string. We currently have: |
| 36 // win_util::GetWinVersion returns WinVersion, which is just | 41 // win_util::GetWinVersion returns WinVersion, which is just |
| 37 // an enum of 2000, XP, 2003, or VISTA. Not enough detail for | 42 // an enum of 2000, XP, 2003, or VISTA. Not enough detail for |
| 38 // bug reports. | 43 // bug reports. |
| 39 // base::SysInfo::OperatingSystemVersion returns an std::string | 44 // base::SysInfo::OperatingSystemVersion returns an std::string |
| 40 // but doesn't include the build or service pack. That function | 45 // but doesn't include the build or service pack. That function |
| 41 // is probably the right one to extend, but will require changing | 46 // is probably the right one to extend, but will require changing |
| 42 // all the call sites or making it a wrapper around another util. | 47 // all the call sites or making it a wrapper around another util. |
| 43 static void SetOSVersion(std::string *os_version); | 48 static void SetOSVersion(std::string *os_version); |
| 44 | 49 |
| 45 // Generates bug report data. | 50 // Generates bug report data. |
| 46 static void SendReport(Profile* profile, | 51 static void SendReport(Profile* profile, |
| 47 std::string page_title_text, | 52 const std::string& page_title_text, |
| 48 int problem_type, | 53 int problem_type, |
| 49 std::string page_url_text, | 54 const std::string& page_url_text, |
| 50 std::string description, | 55 const std::string& description, |
| 51 const char* png_data, | 56 const char* png_data, |
| 52 int png_data_length); | 57 int png_data_length, |
| 58 int png_width, |
| 59 int png_height); |
| 53 | 60 |
| 54 // Redirects the user to Google's phishing reporting page. | 61 // Redirects the user to Google's phishing reporting page. |
| 55 static void ReportPhishing(TabContents* currentTab, | 62 static void ReportPhishing(TabContents* currentTab, |
| 56 const std::string& phishing_url); | 63 const std::string& phishing_url); |
| 57 | 64 |
| 58 static std::string GetMimeType(); | |
| 59 | |
| 60 class PostCleanup; | 65 class PostCleanup; |
| 61 | 66 |
| 62 private: | 67 private: |
| 63 static void CreateMimeBoundary(std::string *out); | 68 // Add a key value pair to the feedback object |
| 69 static void AddFeedbackData( |
| 70 userfeedback::ExternalExtensionSubmit* feedback_data, |
| 71 const std::string& key, const std::string& value); |
| 64 | 72 |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(BugReportUtil); | 73 DISALLOW_IMPLICIT_CONSTRUCTORS(BugReportUtil); |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 #endif // CHROME_BROWSER_BUG_REPORT_UTIL_H_ | 76 #endif // CHROME_BROWSER_BUG_REPORT_UTIL_H_ |
| 69 | |
| OLD | NEW |