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

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

Issue 173133004: Separate pre-classification checks for client-side malware and phishing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set right enum type for boolean histograms. Created 6 years, 8 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 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 const ClientReportMalwareRequestCallback& callback) { 361 const ClientReportMalwareRequestCallback& callback) {
362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
363 scoped_ptr<ClientMalwareRequest> request(verdict); 363 scoped_ptr<ClientMalwareRequest> request(verdict);
364 364
365 if (!enabled_) { 365 if (!enabled_) {
366 if (!callback.is_null()) 366 if (!callback.is_null())
367 callback.Run(GURL(request->url()), GURL(request->url()), false); 367 callback.Run(GURL(request->url()), GURL(request->url()), false);
368 return; 368 return;
369 } 369 }
370 370
371 if (OverMalwareReportLimit()) {
372 UpdateEnumUMAHistogram(REPORT_HIT_LIMIT);
373 DVLOG(1) << "Too many malware report requests sent recently."
374 << "Skip sending malware report for " << GURL(request->url());
375 if (!callback.is_null())
376 callback.Run(GURL(request->url()), GURL(request->url()), false);
377 return;
378 }
379
380 std::string request_data; 371 std::string request_data;
381 if (!request->SerializeToString(&request_data)) { 372 if (!request->SerializeToString(&request_data)) {
382 UpdateEnumUMAHistogram(REPORT_FAILED_SERIALIZATION); 373 UpdateEnumUMAHistogram(REPORT_FAILED_SERIALIZATION);
383 DVLOG(1) << "Unable to serialize the CSD request. Proto file changed?"; 374 DVLOG(1) << "Unable to serialize the CSD request. Proto file changed?";
384 if (!callback.is_null()) 375 if (!callback.is_null())
385 callback.Run(GURL(request->url()), GURL(request->url()), false); 376 callback.Run(GURL(request->url()), GURL(request->url()), false);
386 return; 377 return;
387 } 378 }
388 379
389 net::URLFetcher* fetcher = net::URLFetcher::Create( 380 net::URLFetcher* fetcher = net::URLFetcher::Create(
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 GURL ClientSideDetectionService::GetClientReportUrl( 671 GURL ClientSideDetectionService::GetClientReportUrl(
681 const std::string& report_url) { 672 const std::string& report_url) {
682 GURL url(report_url); 673 GURL url(report_url);
683 std::string api_key = google_apis::GetAPIKey(); 674 std::string api_key = google_apis::GetAPIKey();
684 if (!api_key.empty()) 675 if (!api_key.empty())
685 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 676 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
686 677
687 return url; 678 return url;
688 } 679 }
689 } // namespace safe_browsing 680 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698