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.
5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_
6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_
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"
17 typedef base::Callback
<void(scoped_ptr
<std::string
>)> ReportDataCallback
;
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
{
24 FeedbackUploaderDelegate(scoped_ptr
<std::string
> post_body
,
25 const base::Closure
& success_callback
,
26 const ReportDataCallback
& error_callback
);
27 virtual ~FeedbackUploaderDelegate();
30 // Overridden from net::URLFetcherDelegate.
31 virtual void OnURLFetchComplete(const net::URLFetcher
* source
) OVERRIDE
;
33 scoped_ptr
<std::string
> post_body_
;
34 base::Closure success_callback_
;
35 ReportDataCallback error_callback_
;
37 DISALLOW_COPY_AND_ASSIGN(FeedbackUploaderDelegate
);
40 } // namespace feedback
42 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_