| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 NOTREACHED(); | 287 NOTREACHED(); |
| 288 return String(); | 288 return String(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool isDocumentCrossOrigin(Document& document) { | 291 bool isDocumentCrossOrigin(Document& document) { |
| 292 const LocalFrame* frame = document.frame(); | 292 const LocalFrame* frame = document.frame(); |
| 293 return frame && frame->isCrossOriginSubframe(); | 293 return frame && frame->isCrossOriginSubframe(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 bool isDocumentWhitelisted(Document& document) { |
| 297 DCHECK(document.settings()); |
| 298 |
| 299 const String& whitelistScope = |
| 300 document.settings()->getMediaPlaybackGestureWhitelistScope(); |
| 301 if (whitelistScope.isNull() || whitelistScope.isEmpty()) |
| 302 return false; |
| 303 |
| 304 return document.url().getString().startsWith(whitelistScope); |
| 305 } |
| 306 |
| 296 // Return true if and only if the document settings specifies media playback | 307 // Return true if and only if the document settings specifies media playback |
| 297 // requires user gesture. | 308 // requires user gesture. |
| 298 bool computeLockedPendingUserGesture(Document& document) { | 309 bool computeLockedPendingUserGesture(Document& document) { |
| 299 if (!document.settings()) | 310 if (!document.settings()) |
| 300 return false; | 311 return false; |
| 301 | 312 |
| 313 if (isDocumentWhitelisted(document)) { |
| 314 return false; |
| 315 } |
| 316 |
| 302 if (document.settings()->getCrossOriginMediaPlaybackRequiresUserGesture() && | 317 if (document.settings()->getCrossOriginMediaPlaybackRequiresUserGesture() && |
| 303 isDocumentCrossOrigin(document)) { | 318 isDocumentCrossOrigin(document)) { |
| 304 return true; | 319 return true; |
| 305 } | 320 } |
| 306 | 321 |
| 307 return document.settings()->getMediaPlaybackRequiresUserGesture(); | 322 return document.settings()->getMediaPlaybackRequiresUserGesture(); |
| 308 } | 323 } |
| 309 | 324 |
| 310 } // anonymous namespace | 325 } // anonymous namespace |
| 311 | 326 |
| (...skipping 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4126 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4141 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4127 } | 4142 } |
| 4128 | 4143 |
| 4129 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4144 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
| 4130 m_mostlyFillingViewport = true; | 4145 m_mostlyFillingViewport = true; |
| 4131 if (m_webMediaPlayer) | 4146 if (m_webMediaPlayer) |
| 4132 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4147 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
| 4133 } | 4148 } |
| 4134 | 4149 |
| 4135 } // namespace blink | 4150 } // namespace blink |
| OLD | NEW |