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

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

Issue 780713002: Fix remaining WeakPtrFactory ordering problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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 (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 #include "chrome/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 tab_url_(item->GetTabUrl()), 286 tab_url_(item->GetTabUrl()),
287 tab_referrer_url_(item->GetTabReferrerUrl()), 287 tab_referrer_url_(item->GetTabReferrerUrl()),
288 zipped_executable_(false), 288 zipped_executable_(false),
289 callback_(callback), 289 callback_(callback),
290 service_(service), 290 service_(service),
291 binary_feature_extractor_(binary_feature_extractor), 291 binary_feature_extractor_(binary_feature_extractor),
292 database_manager_(database_manager), 292 database_manager_(database_manager),
293 pingback_enabled_(service_->enabled()), 293 pingback_enabled_(service_->enabled()),
294 finished_(false), 294 finished_(false),
295 type_(ClientDownloadRequest::WIN_EXECUTABLE), 295 type_(ClientDownloadRequest::WIN_EXECUTABLE),
296 weakptr_factory_(this), 296 start_time_(base::TimeTicks::Now()),
297 start_time_(base::TimeTicks::Now()) { 297 weakptr_factory_(this) {
298 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 298 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
299 item_->AddObserver(this); 299 item_->AddObserver(this);
300 } 300 }
301 301
302 void Start() { 302 void Start() {
303 DVLOG(2) << "Starting SafeBrowsing download check for: " 303 DVLOG(2) << "Starting SafeBrowsing download check for: "
304 << item_->DebugString(true); 304 << item_->DebugString(true);
305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
306 // TODO(noelutz): implement some cache to make sure we don't issue the same 306 // TODO(noelutz): implement some cache to make sure we don't issue the same
307 // request over and over again if a user downloads the same binary multiple 307 // request over and over again if a user downloads the same binary multiple
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor_; 898 scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor_;
899 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; 899 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_;
900 const bool pingback_enabled_; 900 const bool pingback_enabled_;
901 scoped_ptr<net::URLFetcher> fetcher_; 901 scoped_ptr<net::URLFetcher> fetcher_;
902 scoped_refptr<SandboxedZipAnalyzer> analyzer_; 902 scoped_refptr<SandboxedZipAnalyzer> analyzer_;
903 base::TimeTicks zip_analysis_start_time_; 903 base::TimeTicks zip_analysis_start_time_;
904 bool finished_; 904 bool finished_;
905 ClientDownloadRequest::DownloadType type_; 905 ClientDownloadRequest::DownloadType type_;
906 std::string client_download_request_data_; 906 std::string client_download_request_data_;
907 base::CancelableTaskTracker request_tracker_; // For HistoryService lookup. 907 base::CancelableTaskTracker request_tracker_; // For HistoryService lookup.
908 base::WeakPtrFactory<CheckClientDownloadRequest> weakptr_factory_;
909 base::TimeTicks start_time_; // Used for stats. 908 base::TimeTicks start_time_; // Used for stats.
910 base::TimeTicks timeout_start_time_; 909 base::TimeTicks timeout_start_time_;
911 base::TimeTicks request_start_time_; 910 base::TimeTicks request_start_time_;
911 base::WeakPtrFactory<CheckClientDownloadRequest> weakptr_factory_;
912 912
913 DISALLOW_COPY_AND_ASSIGN(CheckClientDownloadRequest); 913 DISALLOW_COPY_AND_ASSIGN(CheckClientDownloadRequest);
914 }; 914 };
915 915
916 DownloadProtectionService::DownloadProtectionService( 916 DownloadProtectionService::DownloadProtectionService(
917 SafeBrowsingService* sb_service, 917 SafeBrowsingService* sb_service,
918 net::URLRequestContextGetter* request_context_getter) 918 net::URLRequestContextGetter* request_context_getter)
919 : request_context_getter_(request_context_getter), 919 : request_context_getter_(request_context_getter),
920 enabled_(false), 920 enabled_(false),
921 binary_feature_extractor_(new BinaryFeatureExtractor()), 921 binary_feature_extractor_(new BinaryFeatureExtractor()),
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 GURL DownloadProtectionService::GetDownloadRequestUrl() { 1110 GURL DownloadProtectionService::GetDownloadRequestUrl() {
1111 GURL url(kDownloadRequestUrl); 1111 GURL url(kDownloadRequestUrl);
1112 std::string api_key = google_apis::GetAPIKey(); 1112 std::string api_key = google_apis::GetAPIKey();
1113 if (!api_key.empty()) 1113 if (!api_key.empty())
1114 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 1114 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
1115 1115
1116 return url; 1116 return url;
1117 } 1117 }
1118 1118
1119 } // namespace safe_browsing 1119 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_local_predictor.cc ('k') | chrome/browser/speech/extension_api/tts_extension_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698