Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: third_party/WebKit/Source/core/testing/InternalSettings.cpp

Issue 2850553002: Autoplay: use an autoplay policy setting in Blink. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/InternalSettings.h ('k') | third_party/WebKit/Source/core/testing/InternalSettings.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698