OLD | NEW |
1 // Copyright (c) 2012 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 #include "chrome/browser/feedback/feedback_util.h" | 5 #include "chrome/browser/feedback/feedback_util.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 23 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
24 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
27 #include "content/public/browser/navigation_controller.h" | 27 #include "content/public/browser/navigation_controller.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/common/content_client.h" |
29 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
31 #include "grit/locale_settings.h" | 32 #include "grit/locale_settings.h" |
32 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
33 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
34 #include "net/url_request/url_fetcher.h" | 35 #include "net/url_request/url_fetcher.h" |
35 #include "net/url_request/url_fetcher_delegate.h" | 36 #include "net/url_request/url_fetcher_delegate.h" |
36 #include "net/url_request/url_request_status.h" | 37 #include "net/url_request/url_request_status.h" |
37 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
38 #include "unicode/locid.h" | 39 #include "unicode/locid.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 #endif | 257 #endif |
257 ) { | 258 ) { |
258 // Create google feedback protocol buffer objects | 259 // Create google feedback protocol buffer objects |
259 userfeedback::ExtensionSubmit feedback_data; | 260 userfeedback::ExtensionSubmit feedback_data; |
260 // type id set to 0, unused field but needs to be initialized to 0 | 261 // type id set to 0, unused field but needs to be initialized to 0 |
261 feedback_data.set_type_id(0); | 262 feedback_data.set_type_id(0); |
262 | 263 |
263 userfeedback::CommonData* common_data = feedback_data.mutable_common_data(); | 264 userfeedback::CommonData* common_data = feedback_data.mutable_common_data(); |
264 userfeedback::WebData* web_data = feedback_data.mutable_web_data(); | 265 userfeedback::WebData* web_data = feedback_data.mutable_web_data(); |
265 | 266 |
| 267 // Set our user agent. |
| 268 userfeedback::Navigator* navigator = web_data->mutable_navigator(); |
| 269 navigator->set_user_agent(content::GetUserAgent(GURL())); |
| 270 |
266 // Set GAIA id to 0. We're not using gaia id's for recording | 271 // Set GAIA id to 0. We're not using gaia id's for recording |
267 // use feedback - we're using the e-mail field, allows users to | 272 // use feedback - we're using the e-mail field, allows users to |
268 // submit feedback from incognito mode and specify any mail id | 273 // submit feedback from incognito mode and specify any mail id |
269 // they wish | 274 // they wish |
270 common_data->set_gaia_id(0); | 275 common_data->set_gaia_id(0); |
271 | 276 |
272 // Add the user e-mail to the feedback object | 277 // Add the user e-mail to the feedback object |
273 common_data->set_user_email(user_email_text); | 278 common_data->set_user_email(user_email_text); |
274 | 279 |
275 // Add the description to the feedback object | 280 // Add the description to the feedback object |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 if (screenshot_size == NULL) | 414 if (screenshot_size == NULL) |
410 screenshot_size = new gfx::Rect(); | 415 screenshot_size = new gfx::Rect(); |
411 return *screenshot_size; | 416 return *screenshot_size; |
412 } | 417 } |
413 | 418 |
414 // static | 419 // static |
415 void FeedbackUtil::SetScreenshotSize(const gfx::Rect& rect) { | 420 void FeedbackUtil::SetScreenshotSize(const gfx::Rect& rect) { |
416 gfx::Rect& screen_size = GetScreenshotSize(); | 421 gfx::Rect& screen_size = GetScreenshotSize(); |
417 screen_size = rect; | 422 screen_size = rect; |
418 } | 423 } |
OLD | NEW |