- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / feedback_private / blob_reader.h
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_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "net/base/io_buffer.h"
13 #include "net/url_request/url_fetcher_delegate.h"
14 #include "net/url_request/url_request.h"
15 #include "url/gurl.h"
16
17 class Profile;
18 namespace net {
19 class URLFetcher;
20 }
21
22 class BlobReader : public net::URLFetcherDelegate {
23  public:
24   typedef base::Callback<void(scoped_ptr<std::string> blob_data)>
25       BlobReadCallback;
26
27   BlobReader(Profile* profile,
28              const std::string& blob_uuid,
29              BlobReadCallback callback);
30   virtual ~BlobReader();
31
32   void Start();
33
34  private:
35   // Overridden from net::URLFetcherDelegate.
36   virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
37
38   BlobReadCallback callback_;
39   scoped_ptr<net::URLFetcher> fetcher_;
40
41   DISALLOW_COPY_AND_ASSIGN(BlobReader);
42 };
43
44 #endif  // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_