| 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/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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 whitelisted_url = entry->GetURL(); | 382 whitelisted_url = entry->GetURL(); |
| 383 } else { | 383 } else { |
| 384 whitelisted_url = resource.url; | 384 whitelisted_url = resource.url; |
| 385 } | 385 } |
| 386 | 386 |
| 387 if (pending) { | 387 if (pending) { |
| 388 site_list->InsertPending(whitelisted_url); | 388 site_list->InsertPending(whitelisted_url); |
| 389 } else { | 389 } else { |
| 390 site_list->Insert(whitelisted_url); | 390 site_list->Insert(whitelisted_url); |
| 391 } | 391 } |
| 392 | |
| 393 // Notify security UI that security state has changed. | |
| 394 web_contents->DidChangeVisibleSecurityState(); | |
| 395 } | 392 } |
| 396 | 393 |
| 397 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) { | 394 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) { |
| 398 NavigationEntry* entry = nullptr; | 395 NavigationEntry* entry = nullptr; |
| 399 if (resource.is_subresource) { | 396 if (resource.is_subresource) { |
| 400 entry = resource.GetNavigationEntryForResource(); | 397 entry = resource.GetNavigationEntryForResource(); |
| 401 } | 398 } |
| 402 return IsUrlWhitelistedOrPendingForWebContents( | 399 return IsUrlWhitelistedOrPendingForWebContents( |
| 403 resource.url, resource.is_subresource, entry, | 400 resource.url, resource.is_subresource, entry, |
| 404 resource.web_contents_getter.Run(), true); | 401 resource.web_contents_getter.Run(), true); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 430 | 427 |
| 431 bool whitelisted = site_list->Contains(lookup_url); | 428 bool whitelisted = site_list->Contains(lookup_url); |
| 432 if (whitelist_only) { | 429 if (whitelist_only) { |
| 433 return whitelisted; | 430 return whitelisted; |
| 434 } else { | 431 } else { |
| 435 return whitelisted || site_list->ContainsPending(lookup_url); | 432 return whitelisted || site_list->ContainsPending(lookup_url); |
| 436 } | 433 } |
| 437 } | 434 } |
| 438 | 435 |
| 439 } // namespace safe_browsing | 436 } // namespace safe_browsing |
| OLD | NEW |