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

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

Issue 2270283002: Downgrade security state after user clicks through SB interstitial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove logging statements Created 4 years, 3 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
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if (!entry) 364 if (!entry)
365 return; 365 return;
366 whitelisted_url = entry->GetURL(); 366 whitelisted_url = entry->GetURL();
367 } else { 367 } else {
368 whitelisted_url = resource.url; 368 whitelisted_url = resource.url;
369 } 369 }
370 370
371 site_list->Insert(whitelisted_url); 371 site_list->Insert(whitelisted_url);
372 } 372 }
373 373
374 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) {
375 NavigationEntry* entry = nullptr;
376 if (resource.is_subresource) {
377 entry = resource.GetNavigationEntryForResource();
378 }
379 return IsUrlWhitelistedForWebContents(resource.url, resource.is_subresource,
380 entry,
381 resource.web_contents_getter.Run());
382 }
383
374 // Check if the user has already ignored a SB warning for this WebContents and 384 // Check if the user has already ignored a SB warning for this WebContents and
375 // top-level domain. 385 // top-level domain.
376 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) { 386 bool SafeBrowsingUIManager::IsUrlWhitelistedForWebContents(
387 const GURL& url,
388 bool is_subresource,
389 NavigationEntry* entry,
390 content::WebContents* web_contents) {
377 DCHECK_CURRENTLY_ON(BrowserThread::UI); 391 DCHECK_CURRENTLY_ON(BrowserThread::UI);
378 392
379 GURL maybe_whitelisted_url; 393 GURL maybe_whitelisted_url;
380 if (resource.is_subresource) { 394 if (is_subresource) {
381 NavigationEntry* entry = resource.GetNavigationEntryForResource();
382 if (!entry) 395 if (!entry)
383 return false; 396 return false;
384 maybe_whitelisted_url = entry->GetURL(); 397 maybe_whitelisted_url = entry->GetURL();
385 } else { 398 } else {
386 maybe_whitelisted_url = resource.url; 399 maybe_whitelisted_url = url;
387 } 400 }
388 401
389 WhitelistUrlSet* site_list = static_cast<WhitelistUrlSet*>( 402 WhitelistUrlSet* site_list =
390 resource.web_contents_getter.Run()->GetUserData(kWhitelistKey)); 403 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey));
391 if (!site_list) 404 if (!site_list)
392 return false; 405 return false;
393 return site_list->Contains(maybe_whitelisted_url); 406 return site_list->Contains(maybe_whitelisted_url);
394 } 407 }
395 408
396 } // namespace safe_browsing 409 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager.h ('k') | chrome/browser/ssl/chrome_security_state_model_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698