Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/bitmap_fetcher.h

Issue 263563003: Add referrer & load flag support to BitmapFetcher class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use new start function only Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_BITMAP_FETCHER_H_ 5 #ifndef CHROME_BROWSER_BITMAP_FETCHER_H_
6 #define CHROME_BROWSER_BITMAP_FETCHER_H_ 6 #define CHROME_BROWSER_BITMAP_FETCHER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/bitmap_fetcher_delegate.h" 9 #include "chrome/browser/bitmap_fetcher_delegate.h"
10 #include "chrome/browser/image_decoder.h" 10 #include "chrome/browser/image_decoder.h"
11 #include "net/url_request/url_fetcher_delegate.h" 11 #include "net/url_request/url_fetcher_delegate.h"
12 #include "net/url_request/url_request.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace net { 16 namespace net {
16 class URLFetcher; 17 class URLFetcher;
17 class URLRequestContextGetter; 18 class URLRequestContextGetter;
18 } // namespace net 19 } // namespace net
19 20
20 namespace chrome { 21 namespace chrome {
21 22
22 // Asynchrounously fetches an image from the given URL and returns the 23 // Asynchrounously fetches an image from the given URL and returns the
23 // decoded Bitmap to the provided BitmapFetcherDelegate. 24 // decoded Bitmap to the provided BitmapFetcherDelegate.
24 class BitmapFetcher : public net::URLFetcherDelegate, 25 class BitmapFetcher : public net::URLFetcherDelegate,
25 public ImageDecoder::Delegate { 26 public ImageDecoder::Delegate {
26 public: 27 public:
27 BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate); 28 BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate);
28 virtual ~BitmapFetcher(); 29 virtual ~BitmapFetcher();
29 30
30 const GURL& url() const { return url_; } 31 const GURL& url() const { return url_; }
31 32
32 // Start fetching the URL with the fetcher. The delegate is notified 33 // Start fetching the URL with the fetcher. The delegate is notified
33 // asynchronously when done. Start may be called more than once in some 34 // asynchronously when done. Start may be called more than once in some
34 // cases. If so, subsequent starts will be ignored since the operation is 35 // cases. If so, subsequent starts will be ignored since the operation is
35 // already in progress. 36 // already in progress. Arguments are used to configure the internal fetcher.
sky 2014/05/06 15:24:20 Better document what load_flags is. Specifically i
Kibeom Kim (inactive) 2014/05/06 18:07:14 Done.
36 void Start(net::URLRequestContextGetter* request_context); 37 void Start(net::URLRequestContextGetter* request_context,
38 const std::string& referrer,
39 net::URLRequest::ReferrerPolicy referrer_policy,
40 int load_flags);
37 41
38 // Methods inherited from URLFetcherDelegate 42 // Methods inherited from URLFetcherDelegate
39 43
40 // This will be called when the URL has been fetched, successfully or not. 44 // This will be called when the URL has been fetched, successfully or not.
41 // Use accessor methods on |source| to get the results. 45 // Use accessor methods on |source| to get the results.
42 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 46 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
43 47
44 // This will be called when some part of the response is read. |current| 48 // This will be called when some part of the response is read. |current|
45 // denotes the number of bytes received up to the call, and |total| is the 49 // denotes the number of bytes received up to the call, and |total| is the
46 // expected total size of the response (or -1 if not determined). 50 // expected total size of the response (or -1 if not determined).
(...skipping 20 matching lines...) Expand all
67 scoped_refptr<ImageDecoder> image_decoder_; 71 scoped_refptr<ImageDecoder> image_decoder_;
68 const GURL url_; 72 const GURL url_;
69 BitmapFetcherDelegate* const delegate_; 73 BitmapFetcherDelegate* const delegate_;
70 74
71 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); 75 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher);
72 }; 76 };
73 77
74 } // namespace chrome 78 } // namespace chrome
75 79
76 #endif // CHROME_BROWSER_BITMAP_FETCHER_H_ 80 #endif // CHROME_BROWSER_BITMAP_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698