OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights 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 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 RuntimeEnabledFeatures::setCompositorWorkerEnabled(enabled); | 527 RuntimeEnabledFeatures::setCompositorWorkerEnabled(enabled); |
528 } | 528 } |
529 | 529 |
530 void InternalSettings::setPresentationReceiver( | 530 void InternalSettings::setPresentationReceiver( |
531 bool enabled, | 531 bool enabled, |
532 ExceptionState& exception_state) { | 532 ExceptionState& exception_state) { |
533 InternalSettingsGuardForSettings(); | 533 InternalSettingsGuardForSettings(); |
534 GetSettings()->SetPresentationReceiver(enabled); | 534 GetSettings()->SetPresentationReceiver(enabled); |
535 } | 535 } |
536 | 536 |
| 537 void InternalSettings::setAutoplayPolicy(const String& policy_str, |
| 538 ExceptionState& exception_state) { |
| 539 InternalSettingsGuardForSettings(); |
| 540 |
| 541 AutoplayPolicy::Type policy = AutoplayPolicy::Type::kNoUserGestureRequired; |
| 542 if (policy_str == "no-user-gesture-required") { |
| 543 policy = AutoplayPolicy::Type::kNoUserGestureRequired; |
| 544 } else if (policy_str == "user-gesture-required") { |
| 545 policy = AutoplayPolicy::Type::kUserGestureRequired; |
| 546 } else if (policy_str == "user-gesture-required-for-cross-origin") { |
| 547 policy = AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin; |
| 548 } else { |
| 549 exception_state.ThrowDOMException( |
| 550 kSyntaxError, "The autoplay policy ('" + policy_str + ")' is invalid."); |
| 551 } |
| 552 |
| 553 GetSettings()->SetAutoplayPolicy(policy); |
| 554 } |
| 555 |
537 } // namespace blink | 556 } // namespace blink |
OLD | NEW |