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