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/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
20 #include "chrome/browser/browser_process_impl.h" | 20 #include "chrome/browser/browser_process_impl.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 22 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
23 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/chrome_version_info.h" | 25 #include "chrome/common/chrome_version_info.h" |
26 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/common/content_url_request_user_data.h" |
28 #include "content/public/common/url_fetcher.h" | 29 #include "content/public/common/url_fetcher.h" |
29 #include "content/public/common/url_fetcher_delegate.h" | 30 #include "content/public/common/url_fetcher_delegate.h" |
30 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
31 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
32 #include "grit/locale_settings.h" | 33 #include "grit/locale_settings.h" |
33 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
34 #include "net/base/load_flags.h" | 35 #include "net/base/load_flags.h" |
35 #include "net/url_request/url_request_status.h" | 36 #include "net/url_request/url_request_status.h" |
36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
37 #include "unicode/locid.h" | 38 #include "unicode/locid.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 HasSwitch(switches::kFeedbackServer)) | 195 HasSwitch(switches::kFeedbackServer)) |
195 post_url = GURL(CommandLine::ForCurrentProcess()-> | 196 post_url = GURL(CommandLine::ForCurrentProcess()-> |
196 GetSwitchValueASCII(switches::kFeedbackServer)); | 197 GetSwitchValueASCII(switches::kFeedbackServer)); |
197 else | 198 else |
198 post_url = GURL(kFeedbackPostUrl); | 199 post_url = GURL(kFeedbackPostUrl); |
199 | 200 |
200 content::URLFetcher* fetcher = content::URLFetcher::Create( | 201 content::URLFetcher* fetcher = content::URLFetcher::Create( |
201 post_url, content::URLFetcher::POST, | 202 post_url, content::URLFetcher::POST, |
202 new FeedbackUtil::PostCleanup(profile, post_body, previous_delay)); | 203 new FeedbackUtil::PostCleanup(profile, post_body, previous_delay)); |
203 fetcher->SetRequestContext(profile->GetRequestContext()); | 204 fetcher->SetRequestContext(profile->GetRequestContext()); |
| 205 // TODO(jochen): Do cookie audit. |
| 206 fetcher->SetContentURLRequestUserData( |
| 207 new content::ContentURLRequestUserData()); |
204 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 208 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
205 fetcher->SetUploadData(std::string(kProtBufMimeType), *post_body); | 209 fetcher->SetUploadData(std::string(kProtBufMimeType), *post_body); |
206 fetcher->Start(); | 210 fetcher->Start(); |
207 } | 211 } |
208 | 212 |
209 | 213 |
210 // static | 214 // static |
211 void FeedbackUtil::AddFeedbackData( | 215 void FeedbackUtil::AddFeedbackData( |
212 userfeedback::ExtensionSubmit* feedback_data, | 216 userfeedback::ExtensionSubmit* feedback_data, |
213 const std::string& key, const std::string& value) { | 217 const std::string& key, const std::string& value) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (screenshot_size == NULL) | 417 if (screenshot_size == NULL) |
414 screenshot_size = new gfx::Rect(); | 418 screenshot_size = new gfx::Rect(); |
415 return *screenshot_size; | 419 return *screenshot_size; |
416 } | 420 } |
417 | 421 |
418 // static | 422 // static |
419 void FeedbackUtil::SetScreenshotSize(const gfx::Rect& rect) { | 423 void FeedbackUtil::SetScreenshotSize(const gfx::Rect& rect) { |
420 gfx::Rect& screen_size = GetScreenshotSize(); | 424 gfx::Rect& screen_size = GetScreenshotSize(); |
421 screen_size = rect; | 425 screen_size = rect; |
422 } | 426 } |
OLD | NEW |