| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 bool ClearSiteDataThrottle::HandleHeader() { | 340 bool ClearSiteDataThrottle::HandleHeader() { |
| 341 const net::HttpResponseHeaders* headers = GetResponseHeaders(); | 341 const net::HttpResponseHeaders* headers = GetResponseHeaders(); |
| 342 | 342 |
| 343 std::string header_value; | 343 std::string header_value; |
| 344 if (!headers || | 344 if (!headers || |
| 345 !headers->GetNormalizedHeader(kClearSiteDataHeader, &header_value)) { | 345 !headers->GetNormalizedHeader(kClearSiteDataHeader, &header_value)) { |
| 346 return false; | 346 return false; |
| 347 } | 347 } |
| 348 | 348 |
| 349 // Only accept the header on secure non-unique origins. | 349 // Only accept the header on secure non-opaque origins. |
| 350 if (!IsOriginSecure(GetCurrentURL())) { | 350 if (!IsOriginSecure(GetCurrentURL())) { |
| 351 delegate_->AddMessage(GetCurrentURL(), | 351 delegate_->AddMessage(GetCurrentURL(), |
| 352 "Not supported for insecure origins.", | 352 "Not supported for insecure origins.", |
| 353 CONSOLE_MESSAGE_LEVEL_ERROR); | 353 CONSOLE_MESSAGE_LEVEL_ERROR); |
| 354 return false; | 354 return false; |
| 355 } | 355 } |
| 356 | 356 |
| 357 url::Origin origin(GetCurrentURL()); | 357 url::Origin origin(GetCurrentURL()); |
| 358 if (origin.unique()) { | 358 if (origin.opaque()) { |
| 359 delegate_->AddMessage(GetCurrentURL(), "Not supported for unique origins.", | 359 delegate_->AddMessage(GetCurrentURL(), "Not supported for opaque origins.", |
| 360 CONSOLE_MESSAGE_LEVEL_ERROR); | 360 CONSOLE_MESSAGE_LEVEL_ERROR); |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| 363 | 363 |
| 364 // The LOAD_DO_NOT_SAVE_COOKIES flag prohibits the request from doing any | 364 // The LOAD_DO_NOT_SAVE_COOKIES flag prohibits the request from doing any |
| 365 // modification to cookies. Clear-Site-Data applies this restriction to other | 365 // modification to cookies. Clear-Site-Data applies this restriction to other |
| 366 // data types as well. | 366 // data types as well. |
| 367 // TODO(msramek): Consider showing a blocked icon via | 367 // TODO(msramek): Consider showing a blocked icon via |
| 368 // TabSpecificContentSettings and reporting the action in the "Blocked" | 368 // TabSpecificContentSettings and reporting the action in the "Blocked" |
| 369 // section of the cookies dialog in OIB. | 369 // section of the cookies dialog in OIB. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 Resume(); | 523 Resume(); |
| 524 } | 524 } |
| 525 | 525 |
| 526 void ClearSiteDataThrottle::OutputConsoleMessages() { | 526 void ClearSiteDataThrottle::OutputConsoleMessages() { |
| 527 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); | 527 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); |
| 528 if (info) | 528 if (info) |
| 529 delegate_->OutputMessages(info->GetWebContentsGetterForRequest()); | 529 delegate_->OutputMessages(info->GetWebContentsGetterForRequest()); |
| 530 } | 530 } |
| 531 | 531 |
| 532 } // namespace content | 532 } // namespace content |
| OLD | NEW |