| 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 "content/browser/browsing_data/clear_site_data_throttle.h" | 5 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 return clearing_in_progress_ ? DEFER : PROCEED; | 113 return clearing_in_progress_ ? DEFER : PROCEED; |
| 114 } | 114 } |
| 115 | 115 |
| 116 ClearSiteDataThrottle::ThrottleCheckResult | 116 ClearSiteDataThrottle::ThrottleCheckResult |
| 117 ClearSiteDataThrottle::WillProcessResponse() { | 117 ClearSiteDataThrottle::WillProcessResponse() { |
| 118 HandleHeader(); | 118 HandleHeader(); |
| 119 return clearing_in_progress_ ? DEFER : PROCEED; | 119 return clearing_in_progress_ ? DEFER : PROCEED; |
| 120 } | 120 } |
| 121 | 121 |
| 122 const char* ClearSiteDataThrottle::GetNameForLogging() { |
| 123 return "ClearSiteDataThrottle"; |
| 124 } |
| 125 |
| 122 void ClearSiteDataThrottle::HandleHeader() { | 126 void ClearSiteDataThrottle::HandleHeader() { |
| 123 NavigationHandleImpl* handle = | 127 NavigationHandleImpl* handle = |
| 124 static_cast<NavigationHandleImpl*>(navigation_handle()); | 128 static_cast<NavigationHandleImpl*>(navigation_handle()); |
| 125 const net::HttpResponseHeaders* headers = handle->GetResponseHeaders(); | 129 const net::HttpResponseHeaders* headers = handle->GetResponseHeaders(); |
| 126 | 130 |
| 127 if (!headers || !headers->HasHeader(kClearSiteDataHeader)) | 131 if (!headers || !headers->HasHeader(kClearSiteDataHeader)) |
| 128 return; | 132 return; |
| 129 | 133 |
| 130 // Only accept the header on secure origins. | 134 // Only accept the header on secure origins. |
| 131 if (!IsOriginSecure(current_url_)) { | 135 if (!IsOriginSecure(current_url_)) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 277 |
| 274 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.ClearSiteData.Duration", | 278 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.ClearSiteData.Duration", |
| 275 base::TimeTicks::Now() - clearing_started_, | 279 base::TimeTicks::Now() - clearing_started_, |
| 276 base::TimeDelta::FromMilliseconds(1), | 280 base::TimeDelta::FromMilliseconds(1), |
| 277 base::TimeDelta::FromSeconds(1), 50); | 281 base::TimeDelta::FromSeconds(1), 50); |
| 278 | 282 |
| 279 navigation_handle()->Resume(); | 283 navigation_handle()->Resume(); |
| 280 } | 284 } |
| 281 | 285 |
| 282 } // namespace content | 286 } // namespace content |
| OLD | NEW |