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/loader/safe_browsing_resource_throttle.h" | 5 #include "chrome/browser/loader/safe_browsing_resource_throttle.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (sb_service->database_manager()->IsSupported()) { | 50 if (sb_service->database_manager()->IsSupported()) { |
51 return new SafeBrowsingResourceThrottle(request, resource_type, sb_service); | 51 return new SafeBrowsingResourceThrottle(request, resource_type, sb_service); |
52 } | 52 } |
53 return nullptr; | 53 return nullptr; |
54 } | 54 } |
55 | 55 |
56 SafeBrowsingResourceThrottle::SafeBrowsingResourceThrottle( | 56 SafeBrowsingResourceThrottle::SafeBrowsingResourceThrottle( |
57 const net::URLRequest* request, | 57 const net::URLRequest* request, |
58 content::ResourceType resource_type, | 58 content::ResourceType resource_type, |
59 safe_browsing::SafeBrowsingService* sb_service) | 59 safe_browsing::SafeBrowsingService* sb_service) |
60 : safe_browsing::BaseResourceThrottle(request, | 60 : safe_browsing::BaseResourceThrottle( |
61 resource_type, | 61 request, |
62 sb_service->database_manager(), | 62 resource_type, |
63 sb_service->ui_manager()) {} | 63 safe_browsing::V4FeatureList::IsV4HybridEnabled() |
| 64 ? sb_service->v4_local_database_manager() |
| 65 : sb_service->database_manager(), |
| 66 sb_service->ui_manager()) {} |
64 | 67 |
65 SafeBrowsingResourceThrottle::~SafeBrowsingResourceThrottle() {} | 68 SafeBrowsingResourceThrottle::~SafeBrowsingResourceThrottle() {} |
66 | 69 |
67 const char* SafeBrowsingResourceThrottle::GetNameForLogging() const { | 70 const char* SafeBrowsingResourceThrottle::GetNameForLogging() const { |
68 return "SafeBrowsingResourceThrottle"; | 71 return "SafeBrowsingResourceThrottle"; |
69 } | 72 } |
70 | 73 |
71 void SafeBrowsingResourceThrottle::MaybeDestroyPrerenderContents( | 74 void SafeBrowsingResourceThrottle::MaybeDestroyPrerenderContents( |
72 const content::ResourceRequestInfo* info) { | 75 const content::ResourceRequestInfo* info) { |
73 // Destroy the prefetch with FINAL_STATUS_SAFEBROSWING. | 76 // Destroy the prefetch with FINAL_STATUS_SAFEBROSWING. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 ui_manager->DisplayBlockingPage(resource); | 126 ui_manager->DisplayBlockingPage(resource); |
124 return; | 127 return; |
125 } | 128 } |
126 } | 129 } |
127 | 130 |
128 // Tab is gone or it's being prerendered. | 131 // Tab is gone or it's being prerendered. |
129 content::BrowserThread::PostTask( | 132 content::BrowserThread::PostTask( |
130 content::BrowserThread::IO, FROM_HERE, | 133 content::BrowserThread::IO, FROM_HERE, |
131 base::Bind(&SafeBrowsingResourceThrottle::Cancel, throttle)); | 134 base::Bind(&SafeBrowsingResourceThrottle::Cancel, throttle)); |
132 } | 135 } |
OLD | NEW |