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

Side by Side Diff: chrome/browser/safe_browsing/malware_details_cache.cc

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Implementation of the MalwareDetails class. 5 // Implementation of the MalwareDetails class.
6 6
7 #include "chrome/browser/safe_browsing/malware_details.h" 7 #include "chrome/browser/safe_browsing/malware_details.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Fetch a URL and advance to the next one when done. 69 // Fetch a URL and advance to the next one when done.
70 void MalwareDetailsCacheCollector::OpenEntry() { 70 void MalwareDetailsCacheCollector::OpenEntry() {
71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
72 DVLOG(1) << "OpenEntry"; 72 DVLOG(1) << "OpenEntry";
73 73
74 if (resources_it_ == resources_->end()) { // We are done. 74 if (resources_it_ == resources_->end()) { // We are done.
75 AllDone(true); 75 AllDone(true);
76 return; 76 return;
77 } 77 }
78 78
79 if (!request_context_getter_) { 79 if (!request_context_getter_.get()) {
80 DVLOG(1) << "Missing request context getter"; 80 DVLOG(1) << "Missing request context getter";
81 AllDone(false); 81 AllDone(false);
82 return; 82 return;
83 } 83 }
84 84
85 current_fetch_.reset(net::URLFetcher::Create( 85 current_fetch_.reset(net::URLFetcher::Create(
86 GURL(resources_it_->first), net::URLFetcher::GET, this)); 86 GURL(resources_it_->first), net::URLFetcher::GET, this));
87 current_fetch_->SetRequestContext(request_context_getter_); 87 current_fetch_->SetRequestContext(request_context_getter_.get());
88 // Only from cache, and don't save cookies. 88 // Only from cache, and don't save cookies.
89 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | 89 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE |
90 net::LOAD_DO_NOT_SAVE_COOKIES); 90 net::LOAD_DO_NOT_SAVE_COOKIES);
91 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries. 91 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries.
92 current_fetch_->Start(); // OnURLFetchComplete will be called when done. 92 current_fetch_->Start(); // OnURLFetchComplete will be called when done.
93 } 93 }
94 94
95 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource( 95 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource(
96 const GURL& url) { 96 const GURL& url) {
97 safe_browsing::ResourceMap::iterator it = resources_->find(url.spec()); 97 safe_browsing::ResourceMap::iterator it = resources_->find(url.spec());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); 201 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this));
202 } 202 }
203 203
204 void MalwareDetailsCacheCollector::AllDone(bool success) { 204 void MalwareDetailsCacheCollector::AllDone(bool success) {
205 DVLOG(1) << "AllDone"; 205 DVLOG(1) << "AllDone";
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
207 *result_ = success; 207 *result_ = success;
208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); 208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_);
209 callback_.Reset(); 209 callback_.Reset();
210 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/malware_details.cc ('k') | chrome/browser/safe_browsing/malware_details_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698