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

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

Issue 516663002: Introducing the OffDomainInclusionDetector to analyze resource requests for suspicious activity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: probably unecessary but harmless reset Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/chrome_browser.gypi » ('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 (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/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" 24 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/profiles/profile_manager.h" 26 #include "chrome/browser/profiles/profile_manager.h"
27 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 27 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
28 #include "chrome/browser/safe_browsing/database_manager.h" 28 #include "chrome/browser/safe_browsing/database_manager.h"
29 #include "chrome/browser/safe_browsing/download_protection_service.h" 29 #include "chrome/browser/safe_browsing/download_protection_service.h"
30 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy zer.h" 30 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy zer.h"
31 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze r.h" 31 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze r.h"
32 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" 32 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h"
33 #include "chrome/browser/safe_browsing/incident_reporting/off_domain_inclusion_d etector.h"
33 #include "chrome/browser/safe_browsing/malware_details.h" 34 #include "chrome/browser/safe_browsing/malware_details.h"
34 #include "chrome/browser/safe_browsing/ping_manager.h" 35 #include "chrome/browser/safe_browsing/ping_manager.h"
35 #include "chrome/browser/safe_browsing/protocol_manager.h" 36 #include "chrome/browser/safe_browsing/protocol_manager.h"
36 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 37 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
37 #include "chrome/browser/safe_browsing/ui_manager.h" 38 #include "chrome/browser/safe_browsing/ui_manager.h"
38 #include "chrome/common/chrome_constants.h" 39 #include "chrome/common/chrome_constants.h"
39 #include "chrome/common/chrome_paths.h" 40 #include "chrome/common/chrome_paths.h"
40 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
41 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
42 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 url_request_context_getter_.get())); 234 url_request_context_getter_.get()));
234 } 235 }
235 download_service_.reset(new safe_browsing::DownloadProtectionService( 236 download_service_.reset(new safe_browsing::DownloadProtectionService(
236 this, url_request_context_getter_.get())); 237 this, url_request_context_getter_.get()));
237 #endif 238 #endif
238 239
239 if (IsIncidentReportingServiceEnabled()) { 240 if (IsIncidentReportingServiceEnabled()) {
240 incident_service_.reset(new safe_browsing::IncidentReportingService( 241 incident_service_.reset(new safe_browsing::IncidentReportingService(
241 this, url_request_context_getter_)); 242 this, url_request_context_getter_));
242 } 243 }
244
245 off_domain_inclusion_detector_.reset(
246 new safe_browsing::OffDomainInclusionDetector);
243 #endif 247 #endif
244 248
245 // Track the safe browsing preference of existing profiles. 249 // Track the safe browsing preference of existing profiles.
246 // The SafeBrowsingService will be started if any existing profile has the 250 // The SafeBrowsingService will be started if any existing profile has the
247 // preference enabled. It will also listen for updates to the preferences. 251 // preference enabled. It will also listen for updates to the preferences.
248 ProfileManager* profile_manager = g_browser_process->profile_manager(); 252 ProfileManager* profile_manager = g_browser_process->profile_manager();
249 if (profile_manager) { 253 if (profile_manager) {
250 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); 254 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
251 for (size_t i = 0; i < profiles.size(); ++i) { 255 for (size_t i = 0; i < profiles.size(); ++i) {
252 if (profiles[i]->IsOffTheRecord()) 256 if (profiles[i]->IsOffTheRecord())
(...skipping 20 matching lines...) Expand all
273 STLDeleteValues(&prefs_map_); 277 STLDeleteValues(&prefs_map_);
274 278
275 // Remove Profile creation/destruction observers. 279 // Remove Profile creation/destruction observers.
276 prefs_registrar_.RemoveAll(); 280 prefs_registrar_.RemoveAll();
277 281
278 Stop(true); 282 Stop(true);
279 // The IO thread is going away, so make sure the ClientSideDetectionService 283 // The IO thread is going away, so make sure the ClientSideDetectionService
280 // dtor executes now since it may call the dtor of URLFetcher which relies 284 // dtor executes now since it may call the dtor of URLFetcher which relies
281 // on it. 285 // on it.
282 csd_service_.reset(); 286 csd_service_.reset();
287
288 off_domain_inclusion_detector_.reset();
283 incident_service_.reset(); 289 incident_service_.reset();
284 download_service_.reset(); 290 download_service_.reset();
285 291
286 url_request_context_getter_ = NULL; 292 url_request_context_getter_ = NULL;
287 BrowserThread::PostNonNestableTask( 293 BrowserThread::PostNonNestableTask(
288 BrowserThread::IO, FROM_HERE, 294 BrowserThread::IO, FROM_HERE,
289 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread, 295 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread,
290 this)); 296 this));
291 } 297 }
292 298
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 354 }
349 355
350 void SafeBrowsingService::AddDownloadManager( 356 void SafeBrowsingService::AddDownloadManager(
351 content::DownloadManager* download_manager) { 357 content::DownloadManager* download_manager) {
352 #if defined(FULL_SAFE_BROWSING) 358 #if defined(FULL_SAFE_BROWSING)
353 if (incident_service_) 359 if (incident_service_)
354 incident_service_->AddDownloadManager(download_manager); 360 incident_service_->AddDownloadManager(download_manager);
355 #endif 361 #endif
356 } 362 }
357 363
364 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) {
365 #if defined(FULL_SAFE_BROWSING)
366 if (off_domain_inclusion_detector_)
367 off_domain_inclusion_detector_->OnResourceRequest(request);
368 #endif
369 }
370
358 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { 371 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() {
359 return new SafeBrowsingUIManager(this); 372 return new SafeBrowsingUIManager(this);
360 } 373 }
361 374
362 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { 375 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() {
363 #if defined(FULL_SAFE_BROWSING) 376 #if defined(FULL_SAFE_BROWSING)
364 return new SafeBrowsingDatabaseManager(this); 377 return new SafeBrowsingDatabaseManager(this);
365 #else 378 #else
366 return NULL; 379 return NULL;
367 #endif 380 #endif
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 else 582 else
570 Stop(false); 583 Stop(false);
571 584
572 #if defined(FULL_SAFE_BROWSING) 585 #if defined(FULL_SAFE_BROWSING)
573 if (csd_service_) 586 if (csd_service_)
574 csd_service_->SetEnabledAndRefreshState(enable); 587 csd_service_->SetEnabledAndRefreshState(enable);
575 if (download_service_) 588 if (download_service_)
576 download_service_->SetEnabled(enable); 589 download_service_->SetEnabled(enable);
577 #endif 590 #endif
578 } 591 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698