Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / feedback / feedback_uploader_delegate.h
blob5da18dd62c4a399a17e4c5f2fe7b8c12e3502fe2
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_
8 #include <string>
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"
15 namespace feedback {
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 {
23 public:
24 FeedbackUploaderDelegate(scoped_ptr<std::string> post_body,
25 const base::Closure& success_callback,
26 const ReportDataCallback& error_callback);
27 virtual ~FeedbackUploaderDelegate();
29 private:
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_