Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2045 | 2045 |
| 2046 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) | 2046 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) |
| 2047 return false; | 2047 return false; |
| 2048 | 2048 |
| 2049 FrameLoader& frameloader = frame()->loader(); | 2049 FrameLoader& frameloader = frame()->loader(); |
| 2050 frameloader.clearNavigationHandledByClient(); | 2050 frameloader.clearNavigationHandledByClient(); |
| 2051 frameloader.loadFailed(frameloader.documentLoader(), error); | 2051 frameloader.loadFailed(frameloader.documentLoader(), error); |
| 2052 return true; | 2052 return true; |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 // Called when a navigation is blocked because a Content Security Policy (CSP) | |
| 2056 // is infringed. | |
| 2057 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( | |
| 2058 const blink::WebContentSecurityPolicyViolation& violation) { | |
| 2059 DCHECK(frame() && frame()->document()); | |
| 2060 Document* document = frame()->document(); | |
| 2061 Vector<String> reportEndpoints; | |
| 2062 for (const WebString& endPoint : violation.reportEndpoints) | |
| 2063 reportEndpoints.push_back(endPoint); | |
| 2064 document->contentSecurityPolicy()->reportViolation( | |
| 2065 violation.directive, /* directiveText */ | |
| 2066 ContentSecurityPolicy::getDirectiveType( | |
| 2067 violation.effectiveDirective), /* effectiveType */ | |
| 2068 violation.consoleMessage, /* consoleMessage */ | |
| 2069 violation.blockedUrl, /* blockedUrl */ | |
| 2070 reportEndpoints, /* reportEndpoints */ | |
| 2071 violation.header, /* header */ | |
| 2072 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), | |
| 2073 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */ | |
| 2074 nullptr, /* LocalFrame */ | |
| 2075 violation.afterRedirect ? RedirectStatus::FollowedRedirect | |
| 2076 : RedirectStatus::NoRedirect, | |
| 2077 // TODO(arthursonzogni, clamy) Provide the context line number here. | |
| 2078 // See http://crbug.com/690946 // | |
|
alexmos
2017/03/01 02:22:28
nit: remove extra // at the end
| |
| 2079 0, /* contextLine */ | |
| 2080 nullptr); /* Element */ | |
| 2081 } | |
| 2082 | |
| 2055 bool WebLocalFrameImpl::isLoading() const { | 2083 bool WebLocalFrameImpl::isLoading() const { |
| 2056 if (!frame() || !frame()->document()) | 2084 if (!frame() || !frame()->document()) |
| 2057 return false; | 2085 return false; |
| 2058 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || | 2086 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || |
| 2059 frame()->loader().hasProvisionalNavigation() || | 2087 frame()->loader().hasProvisionalNavigation() || |
| 2060 !frame()->document()->loadEventFinished(); | 2088 !frame()->document()->loadEventFinished(); |
| 2061 } | 2089 } |
| 2062 | 2090 |
| 2063 bool WebLocalFrameImpl::isNavigationScheduledWithin( | 2091 bool WebLocalFrameImpl::isNavigationScheduledWithin( |
| 2064 double intervalInSeconds) const { | 2092 double intervalInSeconds) const { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2438 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2466 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
| 2439 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2467 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2440 } else { | 2468 } else { |
| 2441 clipHtml = | 2469 clipHtml = |
| 2442 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2470 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
| 2443 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2471 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2444 } | 2472 } |
| 2445 } | 2473 } |
| 2446 | 2474 |
| 2447 } // namespace blink | 2475 } // namespace blink |
| OLD | NEW |