| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 class TabContents; | 28 class TabContents; |
| 29 | 29 |
| 30 class BugReportUtil { | 30 class FeedbackUtil { |
| 31 public: | 31 public: |
| 32 | 32 |
| 33 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
| 34 enum BugType { | 34 enum BugType { |
| 35 PAGE_WONT_LOAD = 0, | 35 PAGE_WONT_LOAD = 0, |
| 36 PAGE_LOOKS_ODD, | 36 PAGE_LOOKS_ODD, |
| 37 PHISHING_PAGE, | 37 PHISHING_PAGE, |
| 38 CANT_SIGN_IN, | 38 CANT_SIGN_IN, |
| 39 CHROME_MISBEHAVES, | 39 CHROME_MISBEHAVES, |
| 40 SOMETHING_MISSING, | 40 SOMETHING_MISSING, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 static void SetOSVersion(std::string *os_version); | 56 static void SetOSVersion(std::string *os_version); |
| 57 | 57 |
| 58 // Send the feedback report after the specified delay | 58 // Send the feedback report after the specified delay |
| 59 static void DispatchFeedback(Profile* profile, std::string* feedback_data, | 59 static void DispatchFeedback(Profile* profile, std::string* feedback_data, |
| 60 int64 delay); | 60 int64 delay); |
| 61 | 61 |
| 62 | 62 |
| 63 // Generates bug report data. | 63 // Generates bug report data. |
| 64 static void SendReport( | 64 static void SendReport( |
| 65 Profile* profile | 65 Profile* profile |
| 66 , int problem_type | 66 , const std::string& category_tag |
| 67 , const std::string& page_url_text | 67 , const std::string& page_url_text |
| 68 , const std::string& description | 68 , const std::string& description |
| 69 , ScreenshotDataPtr png_data | 69 , ScreenshotDataPtr png_data |
| 70 , int png_width | 70 , int png_width |
| 71 , int png_height | 71 , int png_height |
| 72 #if defined(OS_CHROMEOS) | 72 #if defined(OS_CHROMEOS) |
| 73 , const std::string& user_email_text | 73 , const std::string& user_email_text |
| 74 , const char* zipped_logs_data | 74 , const char* zipped_logs_data |
| 75 , int zipped_logs_length | 75 , int zipped_logs_length |
| 76 , const chromeos::system::LogDictionaryType* const sys_info | 76 , const chromeos::system::LogDictionaryType* const sys_info |
| 77 #endif | 77 #endif |
| 78 ); | 78 ); |
| 79 // Redirects the user to Google's phishing reporting page. | 79 // Redirects the user to Google's phishing reporting page. |
| 80 static void ReportPhishing(TabContents* currentTab, | 80 static void ReportPhishing(TabContents* currentTab, |
| 81 const std::string& phishing_url); | 81 const std::string& phishing_url); |
| 82 // Maintains a single vector of bytes to store the last screenshot taken. | 82 // Maintains a single vector of bytes to store the last screenshot taken. |
| 83 static std::vector<unsigned char>* GetScreenshotPng(); | 83 static std::vector<unsigned char>* GetScreenshotPng(); |
| 84 static void ClearScreenshotPng(); | 84 static void ClearScreenshotPng(); |
| 85 static void SetScreenshotSize(const gfx::Rect& rect); | 85 static void SetScreenshotSize(const gfx::Rect& rect); |
| 86 static gfx::Rect& GetScreenshotSize(); | 86 static gfx::Rect& GetScreenshotSize(); |
| 87 | 87 |
| 88 class PostCleanup; | 88 class PostCleanup; |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 // Add a key value pair to the feedback object | 91 // Add a key value pair to the feedback object |
| 92 static void AddFeedbackData( | 92 static void AddFeedbackData( |
| 93 userfeedback::ExternalExtensionSubmit* feedback_data, | 93 userfeedback::ExtensionSubmit* feedback_data, |
| 94 const std::string& key, const std::string& value); | 94 const std::string& key, const std::string& value); |
| 95 | 95 |
| 96 // Send the feedback report | 96 // Send the feedback report |
| 97 static void SendFeedback(Profile* profile, std::string* feedback_data, | 97 static void SendFeedback(Profile* profile, std::string* feedback_data, |
| 98 int64 previous_delay); | 98 int64 previous_delay); |
| 99 | 99 |
| 100 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
| 101 static bool ValidFeedbackSize(const std::string& content); | 101 static bool ValidFeedbackSize(const std::string& content); |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 DISALLOW_IMPLICIT_CONSTRUCTORS(BugReportUtil); | 104 DISALLOW_IMPLICIT_CONSTRUCTORS(FeedbackUtil); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 #endif // CHROME_BROWSER_BUG_REPORT_UTIL_H_ | 107 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_ |
| OLD | NEW |