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

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

Issue 4822002: Send malware reports when a user opts-in from the safe browsing interstitial ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // The Safe Browsing service is responsible for downloading anti-phishing and 5 // The Safe Browsing service is responsible for downloading anti-phishing and
6 // anti-malware tables and checking urls against them. 6 // anti-malware tables and checking urls against them.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
10 #pragma once 10 #pragma once
11 11
12 #include <deque> 12 #include <deque>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/hash_tables.h" 17 #include "base/hash_tables.h"
18 #include "base/lock.h" 18 #include "base/lock.h"
19 #include "base/ref_counted.h" 19 #include "base/ref_counted.h"
20 #include "base/scoped_ptr.h" 20 #include "base/scoped_ptr.h"
21 #include "base/time.h" 21 #include "base/time.h"
22 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 22 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
23 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
24 #include "webkit/glue/resource_type.h" 24 #include "webkit/glue/resource_type.h"
25 25
26 class MalwareDetails;
26 class PrefService; 27 class PrefService;
27 class SafeBrowsingDatabase; 28 class SafeBrowsingDatabase;
28 class SafeBrowsingProtocolManager; 29 class SafeBrowsingProtocolManager;
29 class SafeBrowsingServiceFactory; 30 class SafeBrowsingServiceFactory;
30 class URLRequestContextGetter; 31 class URLRequestContextGetter;
31 32
32 namespace base { 33 namespace base {
33 class Thread; 34 class Thread;
34 } 35 }
35 36
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 // Called on the IO thread to reset the database. 176 // Called on the IO thread to reset the database.
176 void ResetDatabase(); 177 void ResetDatabase();
177 178
178 // Log the user perceived delay caused by SafeBrowsing. This delay is the time 179 // Log the user perceived delay caused by SafeBrowsing. This delay is the time
179 // delta starting from when we would have started reading data from the 180 // delta starting from when we would have started reading data from the
180 // network, and ending when the SafeBrowsing check completes indicating that 181 // network, and ending when the SafeBrowsing check completes indicating that
181 // the current page is 'safe'. 182 // the current page is 'safe'.
182 void LogPauseDelay(base::TimeDelta time); 183 void LogPauseDelay(base::TimeDelta time);
183 184
185 // When a safebrowsing blocking page goes away, it calls this method
186 // so the service can serialize and send MalwareDetails.
187 virtual void ReportMalwareDetails(scoped_refptr<MalwareDetails> details);
188
184 protected: 189 protected:
185 // Creates the safe browsing service. Need to initialize before using. 190 // Creates the safe browsing service. Need to initialize before using.
186 SafeBrowsingService(); 191 SafeBrowsingService();
187 192
188 virtual ~SafeBrowsingService(); 193 virtual ~SafeBrowsingService();
189 194
190 private: 195 private:
191 friend class SafeBrowsingServiceFactoryImpl; 196 friend class SafeBrowsingServiceFactoryImpl;
192 197
193 typedef std::set<SafeBrowsingCheck*> CurrentChecks; 198 typedef std::set<SafeBrowsingCheck*> CurrentChecks;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // Internal worker function for processing full hashes. 284 // Internal worker function for processing full hashes.
280 void OnHandleGetHashResults(SafeBrowsingCheck* check, 285 void OnHandleGetHashResults(SafeBrowsingCheck* check,
281 const std::vector<SBFullHashResult>& full_hashes); 286 const std::vector<SBFullHashResult>& full_hashes);
282 287
283 void HandleOneCheck(SafeBrowsingCheck* check, 288 void HandleOneCheck(SafeBrowsingCheck* check,
284 const std::vector<SBFullHashResult>& full_hashes); 289 const std::vector<SBFullHashResult>& full_hashes);
285 290
286 // Invoked on the UI thread to show the blocking page. 291 // Invoked on the UI thread to show the blocking page.
287 void DoDisplayBlockingPage(const UnsafeResource& resource); 292 void DoDisplayBlockingPage(const UnsafeResource& resource);
288 293
289 // Report any pages that contain malware or phishing to the SafeBrowsing 294 // As soon as we create a blocking page, we schedule this method to
290 // service. 295 // report hits to the malware or phishing list to the server.
291 void ReportSafeBrowsingHit(const GURL& malicious_url, 296 void ReportSafeBrowsingHit(const GURL& malicious_url,
292 const GURL& page_url, 297 const GURL& page_url,
293 const GURL& referrer_url, 298 const GURL& referrer_url,
294 bool is_subresource, 299 bool is_subresource,
295 UrlCheckResult threat_type); 300 UrlCheckResult threat_type);
296 301
297 // The factory used to instanciate a SafeBrowsingService object. 302 // The factory used to instanciate a SafeBrowsingService object.
298 // Useful for tests, so they can provide their own implementation of 303 // Useful for tests, so they can provide their own implementation of
299 // SafeBrowsingService. 304 // SafeBrowsingService.
300 static SafeBrowsingServiceFactory* factory_; 305 static SafeBrowsingServiceFactory* factory_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 class SafeBrowsingServiceFactory { 352 class SafeBrowsingServiceFactory {
348 public: 353 public:
349 SafeBrowsingServiceFactory() { } 354 SafeBrowsingServiceFactory() { }
350 virtual ~SafeBrowsingServiceFactory() { } 355 virtual ~SafeBrowsingServiceFactory() { }
351 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 356 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
352 private: 357 private:
353 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 358 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
354 }; 359 };
355 360
356 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 361 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698