| 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 17 matching lines...) Expand all Loading... |
| 28 #include "content/public/browser/navigation_entry.h" | 28 #include "content/public/browser/navigation_entry.h" |
| 29 #include "content/public/browser/notification_details.h" | 29 #include "content/public/browser/notification_details.h" |
| 30 #include "content/public/browser/notification_source.h" | 30 #include "content/public/browser/notification_source.h" |
| 31 #include "content/public/browser/notification_types.h" | 31 #include "content/public/browser/notification_types.h" |
| 32 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
| 33 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
| 34 #include "content/public/browser/resource_request_details.h" | 34 #include "content/public/browser/resource_request_details.h" |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/common/frame_navigate_params.h" | 36 #include "content/public/common/frame_navigate_params.h" |
| 37 #include "content/public/common/url_constants.h" | 37 #include "content/public/common/url_constants.h" |
| 38 #include "net/base/url_constants.h" |
| 38 #include "url/gurl.h" | 39 #include "url/gurl.h" |
| 39 | 40 |
| 40 using content::BrowserThread; | 41 using content::BrowserThread; |
| 41 using content::NavigationEntry; | 42 using content::NavigationEntry; |
| 42 using content::ResourceRequestDetails; | 43 using content::ResourceRequestDetails; |
| 43 using content::WebContents; | 44 using content::WebContents; |
| 44 | 45 |
| 45 namespace safe_browsing { | 46 namespace safe_browsing { |
| 46 | 47 |
| 47 const int ClientSideDetectionHost::kMaxUrlsPerIP = 20; | 48 const int ClientSideDetectionHost::kMaxUrlsPerIP = 20; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 103 |
| 103 if (csd_service_->IsPrivateIPAddress(params_.socket_address.host())) { | 104 if (csd_service_->IsPrivateIPAddress(params_.socket_address.host())) { |
| 104 VLOG(1) << "Skipping phishing classification for URL: " << params_.url | 105 VLOG(1) << "Skipping phishing classification for URL: " << params_.url |
| 105 << " because of hosting on private IP: " | 106 << " because of hosting on private IP: " |
| 106 << params_.socket_address.host(); | 107 << params_.socket_address.host(); |
| 107 DontClassifyForPhishing(NO_CLASSIFY_PRIVATE_IP); | 108 DontClassifyForPhishing(NO_CLASSIFY_PRIVATE_IP); |
| 108 DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP); | 109 DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP); |
| 109 } | 110 } |
| 110 | 111 |
| 111 // For phishing we only classify HTTP pages. | 112 // For phishing we only classify HTTP pages. |
| 112 if (!params_.url.SchemeIs(content::kHttpScheme)) { | 113 if (!params_.url.SchemeIs(net::kHttpScheme)) { |
| 113 VLOG(1) << "Skipping phishing classification for URL: " << params_.url | 114 VLOG(1) << "Skipping phishing classification for URL: " << params_.url |
| 114 << " because it is not HTTP: " | 115 << " because it is not HTTP: " |
| 115 << params_.socket_address.host(); | 116 << params_.socket_address.host(); |
| 116 DontClassifyForPhishing(NO_CLASSIFY_NOT_HTTP_URL); | 117 DontClassifyForPhishing(NO_CLASSIFY_NOT_HTTP_URL); |
| 117 } | 118 } |
| 118 | 119 |
| 119 // Don't run any classifier if the tab is incognito. | 120 // Don't run any classifier if the tab is incognito. |
| 120 if (web_contents_->GetBrowserContext()->IsOffTheRecord()) { | 121 if (web_contents_->GetBrowserContext()->IsOffTheRecord()) { |
| 121 VLOG(1) << "Skipping phishing and malware classification for URL: " | 122 VLOG(1) << "Skipping phishing and malware classification for URL: " |
| 122 << params_.url << " because we're browsing incognito."; | 123 << params_.url << " because we're browsing incognito."; |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 ui_manager_->RemoveObserver(this); | 739 ui_manager_->RemoveObserver(this); |
| 739 | 740 |
| 740 ui_manager_ = ui_manager; | 741 ui_manager_ = ui_manager; |
| 741 if (ui_manager) | 742 if (ui_manager) |
| 742 ui_manager_->AddObserver(this); | 743 ui_manager_->AddObserver(this); |
| 743 | 744 |
| 744 database_manager_ = database_manager; | 745 database_manager_ = database_manager; |
| 745 } | 746 } |
| 746 | 747 |
| 747 } // namespace safe_browsing | 748 } // namespace safe_browsing |
| OLD | NEW |