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

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

Issue 253623002: Remove BitmapFetcher's dependency on Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager.cc ('k') | chrome/browser/bitmap_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace net { 15 namespace net {
16 class URLFetcher; 16 class URLFetcher;
17 class URLRequestContextGetter;
17 } // namespace net 18 } // namespace net
18 19
19 class Profile;
20
21 namespace chrome { 20 namespace chrome {
22 21
23 // Asynchrounously fetches an image from the given URL and returns the 22 // Asynchrounously fetches an image from the given URL and returns the
24 // decoded Bitmap to the provided BitmapFetcherDelegate. 23 // decoded Bitmap to the provided BitmapFetcherDelegate.
25 class BitmapFetcher : public net::URLFetcherDelegate, 24 class BitmapFetcher : public net::URLFetcherDelegate,
26 public ImageDecoder::Delegate { 25 public ImageDecoder::Delegate {
27 public: 26 public:
28 BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate); 27 BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate);
29 virtual ~BitmapFetcher(); 28 virtual ~BitmapFetcher();
30 29
31 const GURL& url() const { return url_; } 30 const GURL& url() const { return url_; }
32 31
33 // Start fetching the URL with the fetcher. The delegate is notified 32 // Start fetching the URL with the fetcher. The delegate is notified
34 // asynchronously when done. Start may be called more than once in some 33 // asynchronously when done. Start may be called more than once in some
35 // cases. If so, subsequent starts will be ignored since the operation is 34 // cases. If so, subsequent starts will be ignored since the operation is
36 // already in progress. 35 // already in progress.
37 void Start(Profile* profile); 36 void Start(net::URLRequestContextGetter* request_context);
38 37
39 // Methods inherited from URLFetcherDelegate 38 // Methods inherited from URLFetcherDelegate
40 39
41 // This will be called when the URL has been fetched, successfully or not. 40 // This will be called when the URL has been fetched, successfully or not.
42 // Use accessor methods on |source| to get the results. 41 // Use accessor methods on |source| to get the results.
43 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 42 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
44 43
45 // This will be called when some part of the response is read. |current| 44 // This will be called when some part of the response is read. |current|
46 // denotes the number of bytes received up to the call, and |total| is the 45 // denotes the number of bytes received up to the call, and |total| is the
47 // expected total size of the response (or -1 if not determined). 46 // expected total size of the response (or -1 if not determined).
(...skipping 20 matching lines...) Expand all
68 scoped_refptr<ImageDecoder> image_decoder_; 67 scoped_refptr<ImageDecoder> image_decoder_;
69 const GURL url_; 68 const GURL url_;
70 BitmapFetcherDelegate* const delegate_; 69 BitmapFetcherDelegate* const delegate_;
71 70
72 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); 71 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher);
73 }; 72 };
74 73
75 } // namespace chrome 74 } // namespace chrome
76 75
77 #endif // CHROME_BROWSER_BITMAP_FETCHER_H_ 76 #endif // CHROME_BROWSER_BITMAP_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager.cc ('k') | chrome/browser/bitmap_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698