| OLD | NEW |
| 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_host.h" | 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 ui_manager_->DisplayBlockingPage(resource); | 636 ui_manager_->DisplayBlockingPage(resource); |
| 637 } | 637 } |
| 638 // If there is true malware verdict, invalidate weakptr so that no longer | 638 // If there is true malware verdict, invalidate weakptr so that no longer |
| 639 // consider the phishing vedict. | 639 // consider the phishing vedict. |
| 640 weak_factory_.InvalidateWeakPtrs(); | 640 weak_factory_.InvalidateWeakPtrs(); |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 | 643 |
| 644 void ClientSideDetectionHost::FeatureExtractionDone( | 644 void ClientSideDetectionHost::FeatureExtractionDone( |
| 645 bool success, | 645 bool success, |
| 646 ClientPhishingRequest* request) { | 646 scoped_ptr<ClientPhishingRequest> request) { |
| 647 DCHECK(request); | 647 DCHECK(request); |
| 648 DVLOG(2) << "Feature extraction done (success:" << success << ") for URL: " | 648 DVLOG(2) << "Feature extraction done (success:" << success << ") for URL: " |
| 649 << request->url() << ". Start sending client phishing request."; | 649 << request->url() << ". Start sending client phishing request."; |
| 650 ClientSideDetectionService::ClientReportPhishingRequestCallback callback; | 650 ClientSideDetectionService::ClientReportPhishingRequestCallback callback; |
| 651 // If the client-side verdict isn't phishing we don't care about the server | 651 // If the client-side verdict isn't phishing we don't care about the server |
| 652 // response because we aren't going to display a warning. | 652 // response because we aren't going to display a warning. |
| 653 if (request->is_phishing()) { | 653 if (request->is_phishing()) { |
| 654 callback = base::Bind(&ClientSideDetectionHost::MaybeShowPhishingWarning, | 654 callback = base::Bind(&ClientSideDetectionHost::MaybeShowPhishingWarning, |
| 655 weak_factory_.GetWeakPtr()); | 655 weak_factory_.GetWeakPtr()); |
| 656 } | 656 } |
| 657 // Send ping even if the browser feature extraction failed. | 657 // Send ping even if the browser feature extraction failed. |
| 658 csd_service_->SendClientReportPhishingRequest( | 658 csd_service_->SendClientReportPhishingRequest( |
| 659 request, // The service takes ownership of the request object. | 659 request.release(), // The service takes ownership of the request object. |
| 660 callback); | 660 callback); |
| 661 } | 661 } |
| 662 | 662 |
| 663 void ClientSideDetectionHost::MalwareFeatureExtractionDone( | 663 void ClientSideDetectionHost::MalwareFeatureExtractionDone( |
| 664 bool feature_extraction_success, | 664 bool feature_extraction_success, |
| 665 scoped_ptr<ClientMalwareRequest> request) { | 665 scoped_ptr<ClientMalwareRequest> request) { |
| 666 DCHECK(request.get()); | 666 DCHECK(request.get()); |
| 667 DVLOG(2) << "Malware Feature extraction done for URL: " << request->url() | 667 DVLOG(2) << "Malware Feature extraction done for URL: " << request->url() |
| 668 << ", with badip url count:" << request->bad_ip_url_info_size(); | 668 << ", with badip url count:" << request->bad_ip_url_info_size(); |
| 669 | 669 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 ui_manager_->RemoveObserver(this); | 737 ui_manager_->RemoveObserver(this); |
| 738 | 738 |
| 739 ui_manager_ = ui_manager; | 739 ui_manager_ = ui_manager; |
| 740 if (ui_manager) | 740 if (ui_manager) |
| 741 ui_manager_->AddObserver(this); | 741 ui_manager_->AddObserver(this); |
| 742 | 742 |
| 743 database_manager_ = database_manager; | 743 database_manager_ = database_manager; |
| 744 } | 744 } |
| 745 | 745 |
| 746 } // namespace safe_browsing | 746 } // namespace safe_browsing |
| OLD | NEW |