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

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

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/bitmap_fetcher.h ('k') | chrome/browser/bitmap_fetcher_browsertest.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 #include "chrome/browser/bitmap_fetcher.h" 5 #include "chrome/browser/bitmap_fetcher.h"
6 6
7 #include "chrome/browser/profiles/profile.h"
8 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
9 #include "net/url_request/url_fetcher.h" 8 #include "net/url_request/url_fetcher.h"
9 #include "net/url_request/url_request_context_getter.h"
10 #include "net/url_request/url_request_status.h" 10 #include "net/url_request/url_request_status.h"
11 11
12 namespace chrome { 12 namespace chrome {
13 13
14 BitmapFetcher::BitmapFetcher(const GURL& url, 14 BitmapFetcher::BitmapFetcher(const GURL& url,
15 BitmapFetcherDelegate* delegate) 15 BitmapFetcherDelegate* delegate)
16 : url_(url), 16 : url_(url),
17 delegate_(delegate) { 17 delegate_(delegate) {
18 } 18 }
19 19
20 BitmapFetcher::~BitmapFetcher() {} 20 BitmapFetcher::~BitmapFetcher() {}
21 21
22 void BitmapFetcher::Start(Profile* profile) { 22 void BitmapFetcher::Start(net::URLRequestContextGetter* request_context) {
23 if (url_fetcher_ != NULL) 23 if (url_fetcher_ != NULL)
24 return; 24 return;
25 25
26 url_fetcher_.reset(net::URLFetcher::Create(url_, net::URLFetcher::GET, this)); 26 url_fetcher_.reset(net::URLFetcher::Create(url_, net::URLFetcher::GET, this));
27 url_fetcher_->SetRequestContext(profile->GetRequestContext()); 27 url_fetcher_->SetRequestContext(request_context);
28 url_fetcher_->Start(); 28 url_fetcher_->Start();
29 } 29 }
30 30
31 // Methods inherited from URLFetcherDelegate. 31 // Methods inherited from URLFetcherDelegate.
32 32
33 void BitmapFetcher::OnURLFetchComplete(const net::URLFetcher* source) { 33 void BitmapFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
34 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 34 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
35 35
36 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) { 36 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) {
37 ReportFailure(); 37 ReportFailure();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 void BitmapFetcher::OnDecodeImageFailed(const ImageDecoder* decoder) { 72 void BitmapFetcher::OnDecodeImageFailed(const ImageDecoder* decoder) {
73 ReportFailure(); 73 ReportFailure();
74 } 74 }
75 75
76 void BitmapFetcher::ReportFailure() { 76 void BitmapFetcher::ReportFailure() {
77 delegate_->OnFetchComplete(url_, NULL); 77 delegate_->OnFetchComplete(url_, NULL);
78 } 78 }
79 79
80 } // namespace chrome 80 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/bitmap_fetcher.h ('k') | chrome/browser/bitmap_fetcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698