| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/safe_browsing/base_ui_manager.h" | 5 #include "components/safe_browsing/base_ui_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 12 #include "components/safe_browsing/base_blocking_page.h" | 13 #include "components/safe_browsing/base_blocking_page.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 | 17 |
| 17 using content::BrowserThread; | 18 using content::BrowserThread; |
| 18 using content::NavigationEntry; | 19 using content::NavigationEntry; |
| 19 using content::WebContents; | 20 using content::WebContents; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return entry->GetURL().GetWithEmptyPath(); | 80 return entry->GetURL().GetWithEmptyPath(); |
| 80 } | 81 } |
| 81 return url.GetWithEmptyPath(); | 82 return url.GetWithEmptyPath(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 WhitelistUrlSet* GetOrCreateWhitelist(WebContents* web_contents) { | 85 WhitelistUrlSet* GetOrCreateWhitelist(WebContents* web_contents) { |
| 85 WhitelistUrlSet* site_list = | 86 WhitelistUrlSet* site_list = |
| 86 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); | 87 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); |
| 87 if (!site_list) { | 88 if (!site_list) { |
| 88 site_list = new WhitelistUrlSet; | 89 site_list = new WhitelistUrlSet; |
| 89 web_contents->SetUserData(kWhitelistKey, site_list); | 90 web_contents->SetUserData(kWhitelistKey, base::WrapUnique(site_list)); |
| 90 } | 91 } |
| 91 return site_list; | 92 return site_list; |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace | 95 } // namespace |
| 95 | 96 |
| 96 namespace safe_browsing { | 97 namespace safe_browsing { |
| 97 | 98 |
| 98 BaseUIManager::BaseUIManager() {} | 99 BaseUIManager::BaseUIManager() {} |
| 99 | 100 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if (resource.is_subresource) { | 352 if (resource.is_subresource) { |
| 352 NavigationEntry* entry = resource.GetNavigationEntryForResource(); | 353 NavigationEntry* entry = resource.GetNavigationEntryForResource(); |
| 353 if (!entry) | 354 if (!entry) |
| 354 return GURL(); | 355 return GURL(); |
| 355 return entry->GetURL().GetWithEmptyPath(); | 356 return entry->GetURL().GetWithEmptyPath(); |
| 356 } | 357 } |
| 357 return resource.url.GetWithEmptyPath(); | 358 return resource.url.GetWithEmptyPath(); |
| 358 } | 359 } |
| 359 | 360 |
| 360 } // namespace safe_browsing | 361 } // namespace safe_browsing |
| OLD | NEW |