OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "net/url_request/url_fetcher_delegate.h" |
| 14 |
| 15 namespace feedback { |
| 16 |
| 17 typedef base::Callback<void(scoped_ptr<std::string>)> ReportDataCallback; |
| 18 |
| 19 // FeedbackUploaderDelegate is a simple http uploader for a feedback report. On |
| 20 // succes or failure, it deletes itself, but on failure it also notifies the |
| 21 // error callback specified when constructing the class instance. |
| 22 class FeedbackUploaderDelegate : public net::URLFetcherDelegate { |
| 23 public: |
| 24 FeedbackUploaderDelegate(scoped_ptr<std::string> post_body, |
| 25 const base::Closure& success_callback, |
| 26 const ReportDataCallback& error_callback); |
| 27 virtual ~FeedbackUploaderDelegate(); |
| 28 |
| 29 private: |
| 30 // Overridden from net::URLFetcherDelegate. |
| 31 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 32 |
| 33 scoped_ptr<std::string> post_body_; |
| 34 base::Closure success_callback_; |
| 35 ReportDataCallback error_callback_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(FeedbackUploaderDelegate); |
| 38 }; |
| 39 |
| 40 } // namespace feedback |
| 41 |
| 42 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ |
OLD | NEW |