Chromium Code Reviews| 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, const String& whitelistScope) { | |
| 297 if (whitelistScope.isNull() || whitelistScope.isEmpty()) | |
| 298 return false; | |
| 299 if (whitelistScope == "*") | |
| 300 return true; | |
|
mlamouri (slow - plz ping)
2017/02/10 14:28:46
How can that happen?
Zhiqiang Zhang (Slow)
2017/02/10 14:47:11
Ah, I was thinking of when the manifest is unscope
| |
| 301 | |
| 302 return document.url().getString().startsWith(whitelistScope); | |
| 303 } | |
| 304 | |
| 296 // Return true if and only if the document settings specifies media playback | 305 // Return true if and only if the document settings specifies media playback |
| 297 // requires user gesture. | 306 // requires user gesture. |
| 298 bool computeLockedPendingUserGesture(Document& document) { | 307 bool computeLockedPendingUserGesture(Document& document) { |
| 299 if (!document.settings()) | 308 if (!document.settings()) |
| 300 return false; | 309 return false; |
| 301 | 310 |
| 311 if (isDocumentWhitelisted( | |
| 312 document, | |
| 313 document.settings()->getMediaPlaybackGestureWhitelistScope())) { | |
|
mlamouri (slow - plz ping)
2017/02/10 14:28:46
I guess you could just pass `document` and get the
Zhiqiang Zhang (Slow)
2017/02/10 14:47:11
Done.
| |
| 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 |