Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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_ | |
|
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
| |
| 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 "googleurl/src/gurl.h" | |
| 13 #include "net/base/io_buffer.h" | |
| 14 #include "net/url_request/url_fetcher_delegate.h" | |
| 15 #include "net/url_request/url_request.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 GURL& blob_url, | |
| 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 net::URLFetcher* fetcher_; | |
| 40 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
| |
| 41 | |
| 42 base::WeakPtrFactory<BlobReader> weak_ptr_factory_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(BlobReader); | |
| 45 }; | |
| 46 | |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_BLOB_READER_H_ | |
| OLD | NEW |