| 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" | 29 #include "content/public/common/url_fetcher.h" |
| 30 #include "content/public/common/url_fetcher_delegate.h" | |
| 31 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
| 32 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 33 #include "grit/locale_settings.h" | 32 #include "grit/locale_settings.h" |
| 34 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
| 35 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.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; |
| 45 | 45 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 const int64 kInitialRetryDelay = 900000; // 15 minutes | 83 const int64 kInitialRetryDelay = 900000; // 15 minutes |
| 84 const int64 kRetryDelayIncreaseFactor = 2; | 84 const int64 kRetryDelayIncreaseFactor = 2; |
| 85 const int64 kRetryDelayLimit = 14400000; // 4 hours | 85 const int64 kRetryDelayLimit = 14400000; // 4 hours |
| 86 | 86 |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 | 90 |
| 91 // Simple content::URLFetcherDelegate to clean up URLFetcher on completion. | 91 // Simple net::URLFetcherDelegate to clean up URLFetcher on completion. |
| 92 class FeedbackUtil::PostCleanup : public content::URLFetcherDelegate { | 92 class FeedbackUtil::PostCleanup : public net::URLFetcherDelegate { |
| 93 public: | 93 public: |
| 94 PostCleanup(Profile* profile, std::string* post_body, | 94 PostCleanup(Profile* profile, std::string* post_body, |
| 95 int64 previous_delay) : profile_(profile), | 95 int64 previous_delay) : profile_(profile), |
| 96 post_body_(post_body), | 96 post_body_(post_body), |
| 97 previous_delay_(previous_delay) { } | 97 previous_delay_(previous_delay) { } |
| 98 // Overridden from content::URLFetcherDelegate. | 98 // Overridden from net::URLFetcherDelegate. |
| 99 virtual void OnURLFetchComplete(const net::URLFetcher* source); | 99 virtual void OnURLFetchComplete(const net::URLFetcher* source); |
| 100 | 100 |
| 101 protected: | 101 protected: |
| 102 virtual ~PostCleanup() {} | 102 virtual ~PostCleanup() {} |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 Profile* profile_; | 105 Profile* profile_; |
| 106 std::string* post_body_; | 106 std::string* post_body_; |
| 107 int64 previous_delay_; | 107 int64 previous_delay_; |
| 108 | 108 |
| (...skipping 305 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 |