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

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

Issue 13979002: Add support for split PSL list distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed chrome_frame compilation issue Created 7 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/ui_manager.h" 5 #include "chrome/browser/safe_browsing/ui_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/debug/leak_tracker.h" 10 #include "base/debug/leak_tracker.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 } 249 }
250 250
251 void SafeBrowsingUIManager::UpdateWhitelist(const UnsafeResource& resource) { 251 void SafeBrowsingUIManager::UpdateWhitelist(const UnsafeResource& resource) {
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
253 // Whitelist this domain and warning type for the given tab. 253 // Whitelist this domain and warning type for the given tab.
254 WhiteListedEntry entry; 254 WhiteListedEntry entry;
255 entry.render_process_host_id = resource.render_process_host_id; 255 entry.render_process_host_id = resource.render_process_host_id;
256 entry.render_view_id = resource.render_view_id; 256 entry.render_view_id = resource.render_view_id;
257 entry.domain = net::RegistryControlledDomainService::GetDomainAndRegistry( 257 entry.domain = net::RegistryControlledDomainService::GetDomainAndRegistry(
258 resource.url); 258 resource.url, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES);
259 entry.threat_type = resource.threat_type; 259 entry.threat_type = resource.threat_type;
260 white_listed_entries_.push_back(entry); 260 white_listed_entries_.push_back(entry);
261 } 261 }
262 262
263 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) { 263 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) {
264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
265 // Check if the user has already ignored our warning for this render_view 265 // Check if the user has already ignored our warning for this render_view
266 // and domain. 266 // and domain.
267 for (size_t i = 0; i < white_listed_entries_.size(); ++i) { 267 for (size_t i = 0; i < white_listed_entries_.size(); ++i) {
268 const WhiteListedEntry& entry = white_listed_entries_[i]; 268 const WhiteListedEntry& entry = white_listed_entries_[i];
269 if (entry.render_process_host_id == resource.render_process_host_id && 269 if (entry.render_process_host_id == resource.render_process_host_id &&
270 entry.render_view_id == resource.render_view_id && 270 entry.render_view_id == resource.render_view_id &&
271 // Threat type must be the same or in the case of phishing they can 271 // Threat type must be the same or in the case of phishing they can
272 // either be client-side phishing URL or a SafeBrowsing phishing URL. 272 // either be client-side phishing URL or a SafeBrowsing phishing URL.
273 // If we show one type of phishing warning we don't want to show a 273 // If we show one type of phishing warning we don't want to show a
274 // second phishing warning. 274 // second phishing warning.
275 (entry.threat_type == resource.threat_type || 275 (entry.threat_type == resource.threat_type ||
276 (entry.threat_type == SB_THREAT_TYPE_URL_PHISHING && 276 (entry.threat_type == SB_THREAT_TYPE_URL_PHISHING &&
277 resource.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) || 277 resource.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) ||
278 (entry.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL && 278 (entry.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL &&
279 resource.threat_type == SB_THREAT_TYPE_URL_PHISHING)) && 279 resource.threat_type == SB_THREAT_TYPE_URL_PHISHING)) &&
280 entry.domain == 280 entry.domain ==
281 net::RegistryControlledDomainService::GetDomainAndRegistry( 281 net::RegistryControlledDomainService::GetDomainAndRegistry(
282 resource.url)) { 282 resource.url, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) {
283 return true; 283 return true;
284 } 284 }
285 } 285 }
286 return false; 286 return false;
287 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698