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/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" | 9 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" |
10 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 10 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
11 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 11 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/resource_controller.h" | 13 #include "content/public/browser/resource_controller.h" |
14 #include "content/public/browser/resource_request_info.h" | 14 #include "content/public/browser/resource_request_info.h" |
| 15 #include "net/url_request/redirect_info.h" |
15 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
16 #include "ui/base/page_transition_types.h" | 17 #include "ui/base/page_transition_types.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // These values corresponds to SupervisedUserSafetyFilterResult in | 23 // These values corresponds to SupervisedUserSafetyFilterResult in |
23 // tools/metrics/histograms/histograms.xml. If you change anything here, make | 24 // tools/metrics/histograms/histograms.xml. If you change anything here, make |
24 // sure to also update histograms.xml accordingly. | 25 // sure to also update histograms.xml accordingly. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 info->GetChildID(), info->GetRouteID(), url, reason, | 141 info->GetChildID(), info->GetRouteID(), url, reason, |
141 base::Bind( | 142 base::Bind( |
142 &SupervisedUserResourceThrottle::OnInterstitialResult, | 143 &SupervisedUserResourceThrottle::OnInterstitialResult, |
143 weak_ptr_factory_.GetWeakPtr()))); | 144 weak_ptr_factory_.GetWeakPtr()))); |
144 } | 145 } |
145 | 146 |
146 void SupervisedUserResourceThrottle::WillStartRequest(bool* defer) { | 147 void SupervisedUserResourceThrottle::WillStartRequest(bool* defer) { |
147 ShowInterstitialIfNeeded(false, request_->url(), defer); | 148 ShowInterstitialIfNeeded(false, request_->url(), defer); |
148 } | 149 } |
149 | 150 |
150 void SupervisedUserResourceThrottle::WillRedirectRequest(const GURL& new_url, | 151 void SupervisedUserResourceThrottle::WillRedirectRequest( |
151 bool* defer) { | 152 const net::RedirectInfo& redirect_info, |
152 ShowInterstitialIfNeeded(true, new_url, defer); | 153 bool* defer) { |
| 154 ShowInterstitialIfNeeded(true, redirect_info.new_url, defer); |
153 } | 155 } |
154 | 156 |
155 const char* SupervisedUserResourceThrottle::GetNameForLogging() const { | 157 const char* SupervisedUserResourceThrottle::GetNameForLogging() const { |
156 return "SupervisedUserResourceThrottle"; | 158 return "SupervisedUserResourceThrottle"; |
157 } | 159 } |
158 | 160 |
159 void SupervisedUserResourceThrottle::OnCheckDone( | 161 void SupervisedUserResourceThrottle::OnCheckDone( |
160 const GURL& url, | 162 const GURL& url, |
161 SupervisedUserURLFilter::FilteringBehavior behavior, | 163 SupervisedUserURLFilter::FilteringBehavior behavior, |
162 SupervisedUserURLFilter::FilteringBehaviorReason reason, | 164 SupervisedUserURLFilter::FilteringBehaviorReason reason, |
(...skipping 18 matching lines...) Expand all Loading... |
181 controller()->Resume(); | 183 controller()->Resume(); |
182 } | 184 } |
183 | 185 |
184 void SupervisedUserResourceThrottle::OnInterstitialResult( | 186 void SupervisedUserResourceThrottle::OnInterstitialResult( |
185 bool continue_request) { | 187 bool continue_request) { |
186 if (continue_request) | 188 if (continue_request) |
187 controller()->Resume(); | 189 controller()->Resume(); |
188 else | 190 else |
189 controller()->Cancel(); | 191 controller()->Cancel(); |
190 } | 192 } |
OLD | NEW |