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

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

Issue 2927123004: Enable client side phishing detection on https sites. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_host.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 if (csd_service_->IsPrivateIPAddress(socket_address_.host())) { 105 if (csd_service_->IsPrivateIPAddress(socket_address_.host())) {
106 DVLOG(1) << "Skipping phishing classification for URL: " << url_ 106 DVLOG(1) << "Skipping phishing classification for URL: " << url_
107 << " because of hosting on private IP: " 107 << " because of hosting on private IP: "
108 << socket_address_.host(); 108 << socket_address_.host();
109 DontClassifyForPhishing(NO_CLASSIFY_PRIVATE_IP); 109 DontClassifyForPhishing(NO_CLASSIFY_PRIVATE_IP);
110 DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP); 110 DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP);
111 } 111 }
112 112
113 // For phishing we only classify HTTP pages.
vakh (use Gerrit instead) 2017/06/08 23:30:31 Any chance this was intended as: this URL is not H
Jialiu Lin 2017/06/09 00:26:11 Good catch. You're right. I should be aware of oth
114 if (!url_.SchemeIs(url::kHttpScheme)) {
115 DVLOG(1) << "Skipping phishing classification for URL: " << url_
116 << " because it is not HTTP: "
117 << socket_address_.host();
118 DontClassifyForPhishing(NO_CLASSIFY_NOT_HTTP_URL);
119 }
120
121 // Don't run any classifier if the tab is incognito. 113 // Don't run any classifier if the tab is incognito.
122 if (web_contents_->GetBrowserContext()->IsOffTheRecord()) { 114 if (web_contents_->GetBrowserContext()->IsOffTheRecord()) {
123 DVLOG(1) << "Skipping phishing and malware classification for URL: " 115 DVLOG(1) << "Skipping phishing and malware classification for URL: "
124 << url_ << " because we're browsing incognito."; 116 << url_ << " because we're browsing incognito.";
125 DontClassifyForPhishing(NO_CLASSIFY_OFF_THE_RECORD); 117 DontClassifyForPhishing(NO_CLASSIFY_OFF_THE_RECORD);
126 DontClassifyForMalware(NO_CLASSIFY_OFF_THE_RECORD); 118 DontClassifyForMalware(NO_CLASSIFY_OFF_THE_RECORD);
127 } 119 }
128 120
129 // We lookup the csd-whitelist before we lookup the cache because 121 // We lookup the csd-whitelist before we lookup the cache because
130 // a URL may have recently been whitelisted. If the URL matches 122 // a URL may have recently been whitelisted. If the URL matches
(...skipping 28 matching lines...) Expand all
159 OBSOLETE_NO_CLASSIFY_PROXY_FETCH, 151 OBSOLETE_NO_CLASSIFY_PROXY_FETCH,
160 NO_CLASSIFY_PRIVATE_IP, 152 NO_CLASSIFY_PRIVATE_IP,
161 NO_CLASSIFY_OFF_THE_RECORD, 153 NO_CLASSIFY_OFF_THE_RECORD,
162 NO_CLASSIFY_MATCH_CSD_WHITELIST, 154 NO_CLASSIFY_MATCH_CSD_WHITELIST,
163 NO_CLASSIFY_TOO_MANY_REPORTS, 155 NO_CLASSIFY_TOO_MANY_REPORTS,
164 NO_CLASSIFY_UNSUPPORTED_MIME_TYPE, 156 NO_CLASSIFY_UNSUPPORTED_MIME_TYPE,
165 NO_CLASSIFY_NO_DATABASE_MANAGER, 157 NO_CLASSIFY_NO_DATABASE_MANAGER,
166 NO_CLASSIFY_KILLSWITCH, 158 NO_CLASSIFY_KILLSWITCH,
167 NO_CLASSIFY_CANCEL, 159 NO_CLASSIFY_CANCEL,
168 NO_CLASSIFY_RESULT_FROM_CACHE, 160 NO_CLASSIFY_RESULT_FROM_CACHE,
169 NO_CLASSIFY_NOT_HTTP_URL, 161 DEPRECATED_NO_CLASSIFY_NOT_HTTP_URL,
170 162
171 NO_CLASSIFY_MAX // Always add new values before this one. 163 NO_CLASSIFY_MAX // Always add new values before this one.
172 }; 164 };
173 165
174 // The destructor can be called either from the UI or the IO thread. 166 // The destructor can be called either from the UI or the IO thread.
175 virtual ~ShouldClassifyUrlRequest() { } 167 virtual ~ShouldClassifyUrlRequest() { }
176 168
177 bool ShouldClassifyForPhishing() const { 169 bool ShouldClassifyForPhishing() const {
178 DCHECK_CURRENTLY_ON(BrowserThread::UI); 170 DCHECK_CURRENTLY_ON(BrowserThread::UI);
179 return !start_phishing_classification_cb_.is_null(); 171 return !start_phishing_classification_cb_.is_null();
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 ui_manager_->RemoveObserver(this); 713 ui_manager_->RemoveObserver(this);
722 714
723 ui_manager_ = ui_manager; 715 ui_manager_ = ui_manager;
724 if (ui_manager) 716 if (ui_manager)
725 ui_manager_->AddObserver(this); 717 ui_manager_->AddObserver(this);
726 718
727 database_manager_ = database_manager; 719 database_manager_ = database_manager;
728 } 720 }
729 721
730 } // namespace safe_browsing 722 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698