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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_
6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "chrome/browser/feedback/feedback_data.h"
13 #include "chrome/browser/feedback/proto/common.pb.h"
14 #include "chrome/browser/feedback/proto/dom.pb.h"
15 #include "chrome/browser/feedback/proto/extension.pb.h"
16 #include "chrome/browser/feedback/proto/math.pb.h"
17 #include "chrome/browser/ui/webui/screenshot_source.h"
18 #include "ui/gfx/rect.h"
20 #if defined(OS_MACOSX)
21 #include "base/sys_info.h"
23 #include "base/win/windows_version.h"
33 extern const char kAppLauncherCategoryTag
[];
39 #if defined(OS_MACOSX)
53 // SetOSVersion copies the maj.minor.build + servicePack_string
54 // into a string. We currently have:
55 // base::win::GetVersion returns WinVersion, which is just
56 // an enum of 2000, XP, 2003, or VISTA. Not enough detail for
58 // base::SysInfo::OperatingSystemVersion returns an std::string
59 // but doesn't include the build or service pack. That function
60 // is probably the right one to extend, but will require changing
61 // all the call sites or making it a wrapper around another util.
62 static void SetOSVersion(std::string
*os_version
);
64 // Send the feedback report after the specified delay
65 static void DispatchFeedback(Profile
* profile
,
66 std::string
* feedback_data
,
69 // Generates bug report data.
70 static void SendReport(scoped_refptr
<FeedbackData
> data
);
71 // Redirects the user to Google's phishing reporting page.
72 static void ReportPhishing(content::WebContents
* current_tab
,
73 const std::string
& phishing_url
);
74 // Maintains a single vector of bytes to store the last screenshot taken.
75 static std::vector
<unsigned char>* GetScreenshotPng();
76 static void ClearScreenshotPng();
77 static void SetScreenshotSize(const gfx::Rect
& rect
);
78 static gfx::Rect
& GetScreenshotSize();
79 static bool ZipString(const std::string
& logs
, std::string
* compressed_logs
);
84 // Add a key value pair to the feedback object
85 static void AddFeedbackData(
86 userfeedback::ExtensionSubmit
* feedback_data
,
87 const std::string
& key
, const std::string
& value
);
89 // Send the feedback report
90 static void SendFeedback(Profile
* profile
,
91 std::string
* feedback_data
,
92 int64 previous_delay
);
94 #if defined(OS_CHROMEOS)
95 static bool ValidFeedbackSize(const std::string
& content
);
98 DISALLOW_IMPLICIT_CONSTRUCTORS(FeedbackUtil
);
101 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UTIL_H_