| OLD | NEW |
| 1 // Copyright (c) 2011 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_BUG_REPORT_UTIL_H_ | 5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_ |
| 6 #define CHROME_BROWSER_BUG_REPORT_UTIL_H_ | 6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/browser/feedback/proto/common.pb.h" |
| 13 #include "chrome/browser/feedback/proto/extension.pb.h" |
| 14 #include "chrome/browser/feedback/proto/math.pb.h" |
| 12 #include "chrome/browser/ui/webui/screenshot_source.h" | 15 #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" | 16 #include "ui/gfx/rect.h" |
| 17 | 17 |
| 18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #elif defined(OS_WIN) | 20 #elif defined(OS_WIN) |
| 21 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 22 #elif defined(OS_CHROMEOS) | 22 #elif defined(OS_CHROMEOS) |
| 23 #include "chrome/browser/chromeos/cros/cros_library.h" | 23 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 24 #include "chrome/browser/chromeos/system/syslogs_provider.h" | 24 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 class Profile; | 27 class Profile; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 class WebContents; | 30 class WebContents; |
| 31 } | 31 } |
| 32 | 32 |
| 33 class BugReportUtil { | 33 class FeedbackUtil { |
| 34 public: | 34 public: |
| 35 | 35 |
| 36 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
| 37 enum BugType { | 37 enum BugType { |
| 38 PAGE_WONT_LOAD = 0, | 38 PAGE_WONT_LOAD = 0, |
| 39 PAGE_LOOKS_ODD, | 39 PAGE_LOOKS_ODD, |
| 40 PHISHING_PAGE, | 40 PHISHING_PAGE, |
| 41 CANT_SIGN_IN, | 41 CANT_SIGN_IN, |
| 42 CHROME_MISBEHAVES, | 42 CHROME_MISBEHAVES, |
| 43 SOMETHING_MISSING, | 43 SOMETHING_MISSING, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 static void SetOSVersion(std::string *os_version); | 59 static void SetOSVersion(std::string *os_version); |
| 60 | 60 |
| 61 // Send the feedback report after the specified delay | 61 // Send the feedback report after the specified delay |
| 62 static void DispatchFeedback(Profile* profile, std::string* feedback_data, | 62 static void DispatchFeedback(Profile* profile, std::string* feedback_data, |
| 63 int64 delay); | 63 int64 delay); |
| 64 | 64 |
| 65 | 65 |
| 66 // Generates bug report data. | 66 // Generates bug report data. |
| 67 static void SendReport( | 67 static void SendReport( |
| 68 Profile* profile | 68 Profile* profile |
| 69 , int problem_type | 69 , const std::string& category_tag |
| 70 , const std::string& page_url_text | 70 , const std::string& page_url_text |
| 71 , const std::string& description | 71 , const std::string& description |
| 72 , ScreenshotDataPtr png_data | 72 , ScreenshotDataPtr png_data |
| 73 , int png_width | 73 , int png_width |
| 74 , int png_height | 74 , int png_height |
| 75 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
| 76 , const std::string& user_email_text | 76 , const std::string& user_email_text |
| 77 , const char* zipped_logs_data | 77 , const char* zipped_logs_data |
| 78 , int zipped_logs_length | 78 , int zipped_logs_length |
| 79 , const chromeos::system::LogDictionaryType* const sys_info | 79 , const chromeos::system::LogDictionaryType* const sys_info |
| 80 #endif | 80 #endif |
| 81 ); | 81 ); |
| 82 // Redirects the user to Google's phishing reporting page. | 82 // Redirects the user to Google's phishing reporting page. |
| 83 static void ReportPhishing(content::WebContents* current_tab, | 83 static void ReportPhishing(content::WebContents* current_tab, |
| 84 const std::string& phishing_url); | 84 const std::string& phishing_url); |
| 85 // Maintains a single vector of bytes to store the last screenshot taken. | 85 // Maintains a single vector of bytes to store the last screenshot taken. |
| 86 static std::vector<unsigned char>* GetScreenshotPng(); | 86 static std::vector<unsigned char>* GetScreenshotPng(); |
| 87 static void ClearScreenshotPng(); | 87 static void ClearScreenshotPng(); |
| 88 static void SetScreenshotSize(const gfx::Rect& rect); | 88 static void SetScreenshotSize(const gfx::Rect& rect); |
| 89 static gfx::Rect& GetScreenshotSize(); | 89 static gfx::Rect& GetScreenshotSize(); |
| 90 | 90 |
| 91 class PostCleanup; | 91 class PostCleanup; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 // Add a key value pair to the feedback object | 94 // Add a key value pair to the feedback object |
| 95 static void AddFeedbackData( | 95 static void AddFeedbackData( |
| 96 userfeedback::ExternalExtensionSubmit* feedback_data, | 96 userfeedback::ExtensionSubmit* feedback_data, |
| 97 const std::string& key, const std::string& value); | 97 const std::string& key, const std::string& value); |
| 98 | 98 |
| 99 // Send the feedback report | 99 // Send the feedback report |
| 100 static void SendFeedback(Profile* profile, std::string* feedback_data, | 100 static void SendFeedback(Profile* profile, std::string* feedback_data, |
| 101 int64 previous_delay); | 101 int64 previous_delay); |
| 102 | 102 |
| 103 #if defined(OS_CHROMEOS) | 103 #if defined(OS_CHROMEOS) |
| 104 static bool ValidFeedbackSize(const std::string& content); | 104 static bool ValidFeedbackSize(const std::string& content); |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 DISALLOW_IMPLICIT_CONSTRUCTORS(BugReportUtil); | 107 DISALLOW_IMPLICIT_CONSTRUCTORS(FeedbackUtil); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 #endif // CHROME_BROWSER_BUG_REPORT_UTIL_H_ | 110 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_ |
| OLD | NEW |