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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 }; | 75 }; |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 namespace safe_browsing { | 79 namespace safe_browsing { |
80 | 80 |
81 // SafeBrowsingUIManager::UnsafeResource --------------------------------------- | 81 // SafeBrowsingUIManager::UnsafeResource --------------------------------------- |
82 | 82 |
83 SafeBrowsingUIManager::UnsafeResource::UnsafeResource() | 83 SafeBrowsingUIManager::UnsafeResource::UnsafeResource() |
84 : is_subresource(false), | 84 : is_subresource(false), |
| 85 is_subframe(false), |
85 threat_type(SB_THREAT_TYPE_SAFE), | 86 threat_type(SB_THREAT_TYPE_SAFE), |
86 threat_source(safe_browsing::ThreatSource::UNKNOWN) {} | 87 threat_source(safe_browsing::ThreatSource::UNKNOWN) {} |
87 | 88 |
88 SafeBrowsingUIManager::UnsafeResource::UnsafeResource( | 89 SafeBrowsingUIManager::UnsafeResource::UnsafeResource( |
89 const UnsafeResource& other) = default; | 90 const UnsafeResource& other) = default; |
90 | 91 |
91 SafeBrowsingUIManager::UnsafeResource::~UnsafeResource() { } | 92 SafeBrowsingUIManager::UnsafeResource::~UnsafeResource() { } |
92 | 93 |
93 bool SafeBrowsingUIManager::UnsafeResource::IsMainPageLoadBlocked() const { | 94 bool SafeBrowsingUIManager::UnsafeResource::IsMainPageLoadBlocked() const { |
94 // Subresource hits cannot happen until after main page load is committed. | 95 // Subresource hits cannot happen until after main page load is committed. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 whitelisted_url = entry->GetURL(); | 383 whitelisted_url = entry->GetURL(); |
383 } else { | 384 } else { |
384 whitelisted_url = resource.url; | 385 whitelisted_url = resource.url; |
385 } | 386 } |
386 | 387 |
387 if (pending) { | 388 if (pending) { |
388 site_list->InsertPending(whitelisted_url); | 389 site_list->InsertPending(whitelisted_url); |
389 } else { | 390 } else { |
390 site_list->Insert(whitelisted_url); | 391 site_list->Insert(whitelisted_url); |
391 } | 392 } |
| 393 |
| 394 // Notify security UI that security state has changed. |
| 395 web_contents->DidChangeVisibleSecurityState(); |
392 } | 396 } |
393 | 397 |
394 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) { | 398 bool SafeBrowsingUIManager::IsWhitelisted(const UnsafeResource& resource) { |
395 NavigationEntry* entry = nullptr; | 399 NavigationEntry* entry = nullptr; |
396 if (resource.is_subresource) { | 400 if (resource.is_subresource) { |
397 entry = resource.GetNavigationEntryForResource(); | 401 entry = resource.GetNavigationEntryForResource(); |
398 } | 402 } |
399 return IsUrlWhitelistedOrPendingForWebContents( | 403 return IsUrlWhitelistedOrPendingForWebContents( |
400 resource.url, resource.is_subresource, entry, | 404 resource.url, resource.is_subresource, entry, |
401 resource.web_contents_getter.Run(), true); | 405 resource.web_contents_getter.Run(), true); |
(...skipping 25 matching lines...) Expand all Loading... |
427 | 431 |
428 bool whitelisted = site_list->Contains(lookup_url); | 432 bool whitelisted = site_list->Contains(lookup_url); |
429 if (whitelist_only) { | 433 if (whitelist_only) { |
430 return whitelisted; | 434 return whitelisted; |
431 } else { | 435 } else { |
432 return whitelisted || site_list->ContainsPending(lookup_url); | 436 return whitelisted || site_list->ContainsPending(lookup_url); |
433 } | 437 } |
434 } | 438 } |
435 | 439 |
436 } // namespace safe_browsing | 440 } // namespace safe_browsing |
OLD | NEW |