Chromium Code Reviews| Index: chrome/browser/extensions/api/feedback_private/blob_reader.h |
| diff --git a/chrome/browser/extensions/api/feedback_private/blob_reader.h b/chrome/browser/extensions/api/feedback_private/blob_reader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..49dedcef4bfce9e10e328d6bd76e6b57a4a300f1 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/feedback_private/blob_reader.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2013 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 CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_ |
|
asargent_no_longer_on_chrome
2013/06/17 19:32:40
It seems like this header and the .cc file could l
rkc
2013/06/17 21:48:19
This is a really basic user of URLFetcher, I almos
asargent_no_longer_on_chrome
2013/06/17 22:12:58
Good point. Is this even used from more than one f
Jói
2013/06/18 10:29:08
I would recommend following the principle of narro
|
| +#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "net/base/io_buffer.h" |
| +#include "net/url_request/url_fetcher_delegate.h" |
| +#include "net/url_request/url_request.h" |
| + |
| +class Profile; |
| +namespace net { |
| +class URLFetcher; |
| +} |
| + |
| +class BlobReader : public net::URLFetcherDelegate { |
| + public: |
| + typedef base::Callback<void(scoped_ptr<std::string> blob_data)> |
| + BlobReadCallback; |
| + |
| + BlobReader(Profile* profile, |
| + const GURL& blob_url, |
| + BlobReadCallback callback); |
| + virtual ~BlobReader(); |
| + |
| + void Start(); |
| + |
| + private: |
| + // Overridden from net::URLFetcherDelegate. |
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| + |
| + BlobReadCallback callback_; |
| + net::URLFetcher* fetcher_; |
| + Profile* profile_; |
|
asargent_no_longer_on_chrome
2013/06/17 19:32:40
nit: I don't see you actually using |profile_| any
rkc
2013/06/17 21:48:19
I don't need to save the profile (hence removing t
asargent_no_longer_on_chrome
2013/06/17 22:12:58
Oops, I missed that (I searched for "profile_" but
|
| + |
| + base::WeakPtrFactory<BlobReader> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlobReader); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_ |