| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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_UTIL_H_ | |
| 6 #define CHROME_BROWSER_BUG_REPORT_UTIL_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "chrome/browser/ui/webui/screenshot_source.h" | |
| 13 #include "chrome/browser/userfeedback/proto/common.pb.h" | |
| 14 #include "chrome/browser/userfeedback/proto/extension.pb.h" | |
| 15 #include "chrome/browser/userfeedback/proto/math.pb.h" | |
| 16 #include "ui/gfx/rect.h" | |
| 17 | |
| 18 #if defined(OS_MACOSX) | |
| 19 #include "base/sys_info.h" | |
| 20 #elif defined(OS_WIN) | |
| 21 #include "base/win/windows_version.h" | |
| 22 #elif defined(OS_CHROMEOS) | |
| 23 #include "chrome/browser/chromeos/cros/cros_library.h" | |
| 24 #include "chrome/browser/chromeos/system/syslogs_provider.h" | |
| 25 #endif | |
| 26 | |
| 27 class Profile; | |
| 28 | |
| 29 namespace content { | |
| 30 class WebContents; | |
| 31 } | |
| 32 | |
| 33 class BugReportUtil { | |
| 34 public: | |
| 35 | |
| 36 #if defined(OS_MACOSX) | |
| 37 enum BugType { | |
| 38 PAGE_WONT_LOAD = 0, | |
| 39 PAGE_LOOKS_ODD, | |
| 40 PHISHING_PAGE, | |
| 41 CANT_SIGN_IN, | |
| 42 CHROME_MISBEHAVES, | |
| 43 SOMETHING_MISSING, | |
| 44 BROWSER_CRASH, | |
| 45 OTHER_PROBLEM | |
| 46 }; | |
| 47 #endif | |
| 48 | |
| 49 | |
| 50 // SetOSVersion copies the maj.minor.build + servicePack_string | |
| 51 // into a string. We currently have: | |
| 52 // base::win::GetVersion returns WinVersion, which is just | |
| 53 // an enum of 2000, XP, 2003, or VISTA. Not enough detail for | |
| 54 // bug reports. | |
| 55 // base::SysInfo::OperatingSystemVersion returns an std::string | |
| 56 // but doesn't include the build or service pack. That function | |
| 57 // is probably the right one to extend, but will require changing | |
| 58 // all the call sites or making it a wrapper around another util. | |
| 59 static void SetOSVersion(std::string *os_version); | |
| 60 | |
| 61 // Send the feedback report after the specified delay | |
| 62 static void DispatchFeedback(Profile* profile, std::string* feedback_data, | |
| 63 int64 delay); | |
| 64 | |
| 65 | |
| 66 // Generates bug report data. | |
| 67 static void SendReport( | |
| 68 Profile* profile | |
| 69 , int problem_type | |
| 70 , const std::string& page_url_text | |
| 71 , const std::string& description | |
| 72 , ScreenshotDataPtr png_data | |
| 73 , int png_width | |
| 74 , int png_height | |
| 75 #if defined(OS_CHROMEOS) | |
| 76 , const std::string& user_email_text | |
| 77 , const char* zipped_logs_data | |
| 78 , int zipped_logs_length | |
| 79 , const chromeos::system::LogDictionaryType* const sys_info | |
| 80 #endif | |
| 81 ); | |
| 82 // Redirects the user to Google's phishing reporting page. | |
| 83 static void ReportPhishing(content::WebContents* current_tab, | |
| 84 const std::string& phishing_url); | |
| 85 // Maintains a single vector of bytes to store the last screenshot taken. | |
| 86 static std::vector<unsigned char>* GetScreenshotPng(); | |
| 87 static void ClearScreenshotPng(); | |
| 88 static void SetScreenshotSize(const gfx::Rect& rect); | |
| 89 static gfx::Rect& GetScreenshotSize(); | |
| 90 | |
| 91 class PostCleanup; | |
| 92 | |
| 93 private: | |
| 94 // Add a key value pair to the feedback object | |
| 95 static void AddFeedbackData( | |
| 96 userfeedback::ExternalExtensionSubmit* feedback_data, | |
| 97 const std::string& key, const std::string& value); | |
| 98 | |
| 99 // Send the feedback report | |
| 100 static void SendFeedback(Profile* profile, std::string* feedback_data, | |
| 101 int64 previous_delay); | |
| 102 | |
| 103 #if defined(OS_CHROMEOS) | |
| 104 static bool ValidFeedbackSize(const std::string& content); | |
| 105 #endif | |
| 106 | |
| 107 DISALLOW_IMPLICIT_CONSTRUCTORS(BugReportUtil); | |
| 108 }; | |
| 109 | |
| 110 #endif // CHROME_BROWSER_BUG_REPORT_UTIL_H_ | |
| OLD | NEW |