| 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_impl.h" | 21 #include "chrome/browser/browser_process_impl.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/url_fetcher.h" | |
| 30 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| 31 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 32 #include "grit/locale_settings.h" | 31 #include "grit/locale_settings.h" |
| 33 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 34 #include "net/base/load_flags.h" | 33 #include "net/base/load_flags.h" |
| 34 #include "net/url_request/url_fetcher.h" |
| 35 #include "net/url_request/url_fetcher_delegate.h" | 35 #include "net/url_request/url_fetcher_delegate.h" |
| 36 #include "net/url_request/url_request_status.h" | 36 #include "net/url_request/url_request_status.h" |
| 37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 38 #include "unicode/locid.h" | 38 #include "unicode/locid.h" |
| 39 | 39 |
| 40 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 41 #include "chrome/browser/chromeos/notifications/system_notification.h" | 41 #include "chrome/browser/chromeos/notifications/system_notification.h" |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 using content::WebContents; | 44 using content::WebContents; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 DCHECK(post_body); | 191 DCHECK(post_body); |
| 192 | 192 |
| 193 GURL post_url; | 193 GURL post_url; |
| 194 if (CommandLine::ForCurrentProcess()-> | 194 if (CommandLine::ForCurrentProcess()-> |
| 195 HasSwitch(switches::kFeedbackServer)) | 195 HasSwitch(switches::kFeedbackServer)) |
| 196 post_url = GURL(CommandLine::ForCurrentProcess()-> | 196 post_url = GURL(CommandLine::ForCurrentProcess()-> |
| 197 GetSwitchValueASCII(switches::kFeedbackServer)); | 197 GetSwitchValueASCII(switches::kFeedbackServer)); |
| 198 else | 198 else |
| 199 post_url = GURL(kFeedbackPostUrl); | 199 post_url = GURL(kFeedbackPostUrl); |
| 200 | 200 |
| 201 net::URLFetcher* fetcher = content::URLFetcher::Create( | 201 net::URLFetcher* fetcher = net::URLFetcher::Create( |
| 202 post_url, net::URLFetcher::POST, | 202 post_url, net::URLFetcher::POST, |
| 203 new FeedbackUtil::PostCleanup(profile, post_body, previous_delay)); | 203 new FeedbackUtil::PostCleanup(profile, post_body, previous_delay)); |
| 204 fetcher->SetRequestContext(profile->GetRequestContext()); | 204 fetcher->SetRequestContext(profile->GetRequestContext()); |
| 205 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 205 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
| 206 fetcher->SetUploadData(std::string(kProtBufMimeType), *post_body); | 206 fetcher->SetUploadData(std::string(kProtBufMimeType), *post_body); |
| 207 fetcher->Start(); | 207 fetcher->Start(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 // static | 211 // static |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 if (screenshot_size == NULL) | 414 if (screenshot_size == NULL) |
| 415 screenshot_size = new gfx::Rect(); | 415 screenshot_size = new gfx::Rect(); |
| 416 return *screenshot_size; | 416 return *screenshot_size; |
| 417 } | 417 } |
| 418 | 418 |
| 419 // static | 419 // static |
| 420 void FeedbackUtil::SetScreenshotSize(const gfx::Rect& rect) { | 420 void FeedbackUtil::SetScreenshotSize(const gfx::Rect& rect) { |
| 421 gfx::Rect& screen_size = GetScreenshotSize(); | 421 gfx::Rect& screen_size = GetScreenshotSize(); |
| 422 screen_size = rect; | 422 screen_size = rect; |
| 423 } | 423 } |
| OLD | NEW |