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 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 | 90 |
91 // Simple content::URLFetcherDelegate to clean up URLFetcher on completion. | 91 // Simple content::URLFetcherDelegate to clean up URLFetcher on completion. |
92 class FeedbackUtil::PostCleanup : public content::URLFetcherDelegate { | 92 class FeedbackUtil::PostCleanup : public content::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 content::URLFetcherDelegate. |
99 virtual void OnURLFetchComplete(const content::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 |
109 DISALLOW_COPY_AND_ASSIGN(PostCleanup); | 109 DISALLOW_COPY_AND_ASSIGN(PostCleanup); |
110 }; | 110 }; |
111 | 111 |
112 // Don't use the data parameter, instead use the pointer we pass into every | 112 // Don't use the data parameter, instead use the pointer we pass into every |
113 // post cleanup object - that pointer will be deleted and deleted only on a | 113 // post cleanup object - that pointer will be deleted and deleted only on a |
114 // successful post to the feedback server. | 114 // successful post to the feedback server. |
115 void FeedbackUtil::PostCleanup::OnURLFetchComplete( | 115 void FeedbackUtil::PostCleanup::OnURLFetchComplete( |
116 const content::URLFetcher* source) { | 116 const net::URLFetcher* source) { |
117 std::stringstream error_stream; | 117 std::stringstream error_stream; |
118 int response_code = source->GetResponseCode(); | 118 int response_code = source->GetResponseCode(); |
119 if (response_code == kHttpPostSuccessNoContent) { | 119 if (response_code == kHttpPostSuccessNoContent) { |
120 // We've sent our report, delete the report data | 120 // We've sent our report, delete the report data |
121 delete post_body_; | 121 delete post_body_; |
122 | 122 |
123 error_stream << "Success"; | 123 error_stream << "Success"; |
124 } else { | 124 } else { |
125 // Uh oh, feedback failed, send it off to retry | 125 // Uh oh, feedback failed, send it off to retry |
126 if (previous_delay_) { | 126 if (previous_delay_) { |
(...skipping 287 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 |