| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_resource_throttle.h" | 5 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" | 10 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" |
| 11 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 11 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 12 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 12 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/resource_controller.h" | |
| 15 #include "content/public/browser/resource_request_info.h" | 14 #include "content/public/browser/resource_request_info.h" |
| 16 #include "net/url_request/redirect_info.h" | 15 #include "net/url_request/redirect_info.h" |
| 17 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
| 18 #include "ui/base/page_transition_types.h" | 17 #include "ui/base/page_transition_types.h" |
| 19 | 18 |
| 20 using content::BrowserThread; | 19 using content::BrowserThread; |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 // These values corresponds to SupervisedUserSafetyFilterResult in | 23 // These values corresponds to SupervisedUserSafetyFilterResult in |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // SafeSites-only UMA events. | 198 // SafeSites-only UMA events. |
| 200 if (url_filter_->HasBlacklist() && url_filter_->HasAsyncURLChecker() && | 199 if (url_filter_->HasBlacklist() && url_filter_->HasAsyncURLChecker() && |
| 201 (reason == supervised_user_error_page::ASYNC_CHECKER || | 200 (reason == supervised_user_error_page::ASYNC_CHECKER || |
| 202 reason == supervised_user_error_page::BLACKLIST)) { | 201 reason == supervised_user_error_page::BLACKLIST)) { |
| 203 RecordFilterResultEvent(true, behavior, reason, uncertain, transition); | 202 RecordFilterResultEvent(true, behavior, reason, uncertain, transition); |
| 204 } | 203 } |
| 205 | 204 |
| 206 if (behavior == SupervisedUserURLFilter::BLOCK) | 205 if (behavior == SupervisedUserURLFilter::BLOCK) |
| 207 ShowInterstitial(url, reason); | 206 ShowInterstitial(url, reason); |
| 208 else if (deferred_) | 207 else if (deferred_) |
| 209 controller()->Resume(); | 208 Resume(); |
| 210 } | 209 } |
| 211 | 210 |
| 212 void SupervisedUserResourceThrottle::OnInterstitialResult( | 211 void SupervisedUserResourceThrottle::OnInterstitialResult( |
| 213 bool continue_request) { | 212 bool continue_request) { |
| 214 if (continue_request) | 213 if (continue_request) |
| 215 controller()->Resume(); | 214 Resume(); |
| 216 else | 215 else |
| 217 controller()->Cancel(); | 216 Cancel(); |
| 218 } | 217 } |
| OLD | NEW |