| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return new ClientSideDetectionHost(tab); | 316 return new ClientSideDetectionHost(tab); |
| 317 } | 317 } |
| 318 | 318 |
| 319 ClientSideDetectionHost::ClientSideDetectionHost(WebContents* tab) | 319 ClientSideDetectionHost::ClientSideDetectionHost(WebContents* tab) |
| 320 : content::WebContentsObserver(tab), | 320 : content::WebContentsObserver(tab), |
| 321 csd_service_(NULL), | 321 csd_service_(NULL), |
| 322 classification_request_(NULL), | 322 classification_request_(NULL), |
| 323 should_extract_malware_features_(true), | 323 should_extract_malware_features_(true), |
| 324 should_classify_for_malware_(false), | 324 should_classify_for_malware_(false), |
| 325 pageload_complete_(false), | 325 pageload_complete_(false), |
| 326 weak_factory_(this), | 326 unsafe_unique_page_id_(-1), |
| 327 unsafe_unique_page_id_(-1) { | 327 weak_factory_(this) { |
| 328 DCHECK(tab); | 328 DCHECK(tab); |
| 329 // Note: csd_service_ and sb_service will be NULL here in testing. | 329 // Note: csd_service_ and sb_service will be NULL here in testing. |
| 330 csd_service_ = g_browser_process->safe_browsing_detection_service(); | 330 csd_service_ = g_browser_process->safe_browsing_detection_service(); |
| 331 feature_extractor_.reset(new BrowserFeatureExtractor(tab, this)); | 331 feature_extractor_.reset(new BrowserFeatureExtractor(tab, this)); |
| 332 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, | 332 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, |
| 333 content::Source<WebContents>(tab)); | 333 content::Source<WebContents>(tab)); |
| 334 | 334 |
| 335 scoped_refptr<SafeBrowsingService> sb_service = | 335 scoped_refptr<SafeBrowsingService> sb_service = |
| 336 g_browser_process->safe_browsing_service(); | 336 g_browser_process->safe_browsing_service(); |
| 337 if (sb_service.get()) { | 337 if (sb_service.get()) { |
| (...skipping 399 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 |