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

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

Issue 845663004: Initial script request detector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use GetLastCommittedURL instead of going through the SiteInstance on the RFH Created 5 years, 10 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
« 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 #if defined(OS_WIN) 51 #if defined(OS_WIN)
52 #include "chrome/installer/util/browser_distribution.h" 52 #include "chrome/installer/util/browser_distribution.h"
53 #endif 53 #endif
54 54
55 #if defined(FULL_SAFE_BROWSING) 55 #if defined(FULL_SAFE_BROWSING)
56 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy zer.h" 56 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy zer.h"
57 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze r.h" 57 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze r.h"
58 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" 58 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h"
59 #include "chrome/browser/safe_browsing/incident_reporting/off_domain_inclusion_d etector.h" 59 #include "chrome/browser/safe_browsing/incident_reporting/off_domain_inclusion_d etector.h"
60 #include "chrome/browser/safe_browsing/incident_reporting/script_request_detecto r.h"
60 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat ure_analyzer.h" 61 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat ure_analyzer.h"
61 #endif 62 #endif
62 63
63 using content::BrowserThread; 64 using content::BrowserThread;
64 65
65 namespace { 66 namespace {
66 67
67 // Filename suffix for the cookie database. 68 // Filename suffix for the cookie database.
68 const base::FilePath::CharType kCookiesFile[] = FILE_PATH_LITERAL(" Cookies"); 69 const base::FilePath::CharType kCookiesFile[] = FILE_PATH_LITERAL(" Cookies");
69 70
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 csd_service_.reset(safe_browsing::ClientSideDetectionService::Create( 226 csd_service_.reset(safe_browsing::ClientSideDetectionService::Create(
226 url_request_context_getter_.get())); 227 url_request_context_getter_.get()));
227 } 228 }
228 download_service_.reset(new safe_browsing::DownloadProtectionService( 229 download_service_.reset(new safe_browsing::DownloadProtectionService(
229 this, url_request_context_getter_.get())); 230 this, url_request_context_getter_.get()));
230 #endif 231 #endif
231 232
232 if (IsIncidentReportingServiceEnabled()) { 233 if (IsIncidentReportingServiceEnabled()) {
233 incident_service_.reset(new safe_browsing::IncidentReportingService( 234 incident_service_.reset(new safe_browsing::IncidentReportingService(
234 this, url_request_context_getter_)); 235 this, url_request_context_getter_));
236 script_request_detector_.reset(new safe_browsing::ScriptRequestDetector(
237 incident_service_->GetIncidentReceiver()));
235 } 238 }
236 239
237 off_domain_inclusion_detector_.reset( 240 off_domain_inclusion_detector_.reset(
238 new safe_browsing::OffDomainInclusionDetector(database_manager_)); 241 new safe_browsing::OffDomainInclusionDetector(database_manager_));
239 #endif 242 #endif
240 243
241 // Track the safe browsing preference of existing profiles. 244 // Track the safe browsing preference of existing profiles.
242 // The SafeBrowsingService will be started if any existing profile has the 245 // The SafeBrowsingService will be started if any existing profile has the
243 // preference enabled. It will also listen for updates to the preferences. 246 // preference enabled. It will also listen for updates to the preferences.
244 ProfileManager* profile_manager = g_browser_process->profile_manager(); 247 ProfileManager* profile_manager = g_browser_process->profile_manager();
(...skipping 27 matching lines...) Expand all
272 prefs_registrar_.RemoveAll(); 275 prefs_registrar_.RemoveAll();
273 276
274 Stop(true); 277 Stop(true);
275 // The IO thread is going away, so make sure the ClientSideDetectionService 278 // The IO thread is going away, so make sure the ClientSideDetectionService
276 // dtor executes now since it may call the dtor of URLFetcher which relies 279 // dtor executes now since it may call the dtor of URLFetcher which relies
277 // on it. 280 // on it.
278 csd_service_.reset(); 281 csd_service_.reset();
279 282
280 #if defined(FULL_SAFE_BROWSING) 283 #if defined(FULL_SAFE_BROWSING)
281 off_domain_inclusion_detector_.reset(); 284 off_domain_inclusion_detector_.reset();
285 script_request_detector_.reset();
282 incident_service_.reset(); 286 incident_service_.reset();
283 #endif 287 #endif
284 288
285 download_service_.reset(); 289 download_service_.reset();
286 290
287 url_request_context_getter_ = NULL; 291 url_request_context_getter_ = NULL;
288 BrowserThread::PostNonNestableTask( 292 BrowserThread::PostNonNestableTask(
289 BrowserThread::IO, FROM_HERE, 293 BrowserThread::IO, FROM_HERE,
290 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread, 294 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread,
291 this)); 295 this));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 #if defined(FULL_SAFE_BROWSING) 357 #if defined(FULL_SAFE_BROWSING)
354 if (incident_service_) 358 if (incident_service_)
355 incident_service_->AddDownloadManager(download_manager); 359 incident_service_->AddDownloadManager(download_manager);
356 #endif 360 #endif
357 } 361 }
358 362
359 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) { 363 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) {
360 #if defined(FULL_SAFE_BROWSING) 364 #if defined(FULL_SAFE_BROWSING)
361 if (off_domain_inclusion_detector_) 365 if (off_domain_inclusion_detector_)
362 off_domain_inclusion_detector_->OnResourceRequest(request); 366 off_domain_inclusion_detector_->OnResourceRequest(request);
367 if (script_request_detector_)
368 script_request_detector_->OnResourceRequest(request);
363 #endif 369 #endif
364 } 370 }
365 371
366 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { 372 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() {
367 return new SafeBrowsingUIManager(this); 373 return new SafeBrowsingUIManager(this);
368 } 374 }
369 375
370 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { 376 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() {
371 #if defined(FULL_SAFE_BROWSING) 377 #if defined(FULL_SAFE_BROWSING)
372 return new SafeBrowsingDatabaseManager(this); 378 return new SafeBrowsingDatabaseManager(this);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 else 600 else
595 Stop(false); 601 Stop(false);
596 602
597 #if defined(FULL_SAFE_BROWSING) 603 #if defined(FULL_SAFE_BROWSING)
598 if (csd_service_) 604 if (csd_service_)
599 csd_service_->SetEnabledAndRefreshState(enable); 605 csd_service_->SetEnabledAndRefreshState(enable);
600 if (download_service_) 606 if (download_service_)
601 download_service_->SetEnabled(enable); 607 download_service_->SetEnabled(enable);
602 #endif 608 #endif
603 } 609 }
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