| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Add the metadata that this page has scripts inserted via document.write | 178 // Add the metadata that this page has scripts inserted via document.write |
| 179 // that are eligible for blocking. Note that if there are multiple scripts | 179 // that are eligible for blocking. Note that if there are multiple scripts |
| 180 // the flag will be conveyed to the browser process only once. | 180 // the flag will be conveyed to the browser process only once. |
| 181 document.loader()->didObserveLoadingBehavior( | 181 document.loader()->didObserveLoadingBehavior( |
| 182 WebLoadingBehaviorFlag::WebLoadingBehaviorDocumentWriteBlock); | 182 WebLoadingBehaviorFlag::WebLoadingBehaviorDocumentWriteBlock); |
| 183 | 183 |
| 184 const bool is2G = | 184 const bool is2G = |
| 185 networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; | 185 networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; |
| 186 WebEffectiveConnectionType effectiveConnection = | 186 WebEffectiveConnectionType effectiveConnection = |
| 187 document.frame()->client()->getEffectiveConnectionType(); | 187 document.frame()->client()->getEffectiveConnectionType(); |
| 188 const bool is2GOrLike2G = | |
| 189 is2G || isConnectionEffectively2G(effectiveConnection); | |
| 190 | 188 |
| 191 return document.settings() | 189 return document.settings() |
| 192 ->getDisallowFetchForDocWrittenScriptsInMainFrame() || | 190 ->getDisallowFetchForDocWrittenScriptsInMainFrame() || |
| 193 (document.settings() | 191 (document.settings() |
| 194 ->getDisallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections
() && | 192 ->getDisallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections
() && |
| 195 is2G) || | 193 is2G) || |
| 196 (document.settings() | 194 (document.settings() |
| 197 ->getDisallowFetchForDocWrittenScriptsInMainFrameIfEffectively2G()
&& | 195 ->getDisallowFetchForDocWrittenScriptsInMainFrameIfEffectively2G()
&& |
| 198 is2GOrLike2G); | 196 isConnectionEffectively2G(effectiveConnection)); |
| 199 } | 197 } |
| 200 | 198 |
| 201 } // namespace | 199 } // namespace |
| 202 | 200 |
| 203 FrameFetchContext::FrameFetchContext(DocumentLoader* loader, Document* document) | 201 FrameFetchContext::FrameFetchContext(DocumentLoader* loader, Document* document) |
| 204 : m_document(document), m_documentLoader(loader) { | 202 : m_document(document), m_documentLoader(loader) { |
| 205 DCHECK(frame()); | 203 DCHECK(frame()); |
| 206 } | 204 } |
| 207 | 205 |
| 208 FrameFetchContext::~FrameFetchContext() { | 206 FrameFetchContext::~FrameFetchContext() { |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 response); | 1057 response); |
| 1060 } | 1058 } |
| 1061 | 1059 |
| 1062 DEFINE_TRACE(FrameFetchContext) { | 1060 DEFINE_TRACE(FrameFetchContext) { |
| 1063 visitor->trace(m_document); | 1061 visitor->trace(m_document); |
| 1064 visitor->trace(m_documentLoader); | 1062 visitor->trace(m_documentLoader); |
| 1065 FetchContext::trace(visitor); | 1063 FetchContext::trace(visitor); |
| 1066 } | 1064 } |
| 1067 | 1065 |
| 1068 } // namespace blink | 1066 } // namespace blink |
| OLD | NEW |