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/renderer_host/safe_browsing_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/prerender/prerender_contents.h" | 10 #include "chrome/browser/prerender/prerender_contents.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 SafeBrowsingResourceThrottle* SafeBrowsingResourceThrottle::MaybeCreate( | 56 SafeBrowsingResourceThrottle* SafeBrowsingResourceThrottle::MaybeCreate( |
57 net::URLRequest* request, | 57 net::URLRequest* request, |
58 content::ResourceType resource_type, | 58 content::ResourceType resource_type, |
59 SafeBrowsingService* sb_service) { | 59 SafeBrowsingService* sb_service) { |
60 #if defined(SAFE_BROWSING_DB_LOCAL) | 60 #if defined(SAFE_BROWSING_DB_LOCAL) |
61 // Throttle consults a local database before starting the resource request. | 61 // Throttle consults a local database before starting the resource request. |
62 return new SafeBrowsingResourceThrottle( | 62 return new SafeBrowsingResourceThrottle( |
63 request, resource_type, sb_service, DEFER_AT_START, | 63 request, resource_type, sb_service, DEFER_AT_START, |
64 SafeBrowsingService::CHECK_ALL_RESOURCE_TYPES); | 64 SafeBrowsingService::CHECK_ALL_RESOURCE_TYPES); |
65 #elif defined(SAFE_BROWSING_DB_REMOTE) | 65 #elif defined(SAFE_BROWSING_DB_REMOTE) |
66 if (!sb_service->IsAndroidFieldTrialEnabled()) | 66 if (!sb_service->IsAndroidFieldTrialEnabled() || |
| 67 !sb_service->database_manager()->IsSupported()) { |
67 return nullptr; | 68 return nullptr; |
| 69 } |
68 | 70 |
69 // Throttle consults a remote database before processing the response. | 71 // Throttle consults a remote database before processing the response. |
70 return new SafeBrowsingResourceThrottle( | 72 return new SafeBrowsingResourceThrottle( |
71 request, resource_type, sb_service, DONT_DEFER_AT_START, | 73 request, resource_type, sb_service, DONT_DEFER_AT_START, |
72 sb_service->GetResourceTypesToCheck()); | 74 sb_service->GetResourceTypesToCheck()); |
73 #else | 75 #else |
74 #error "Incompatible compile flags for safe_browsing_resource_throttle" | 76 #error "Incompatible compile flags for safe_browsing_resource_throttle" |
75 #endif | 77 #endif |
76 } | 78 } |
77 | 79 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 defer_state_ = DEFERRED_REDIRECT; | 324 defer_state_ = DEFERRED_REDIRECT; |
323 resume = false; | 325 resume = false; |
324 } | 326 } |
325 } | 327 } |
326 | 328 |
327 if (resume) { | 329 if (resume) { |
328 defer_state_ = DEFERRED_NONE; | 330 defer_state_ = DEFERRED_NONE; |
329 controller()->Resume(); | 331 controller()->Resume(); |
330 } | 332 } |
331 } | 333 } |
OLD | NEW |