blob: 66187cccf657726d173b1c61838a151027be4fa7 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/platform/supplementable.h"
namespace blink {
class ExecutionContext;
// ContextFeatureSettings attaches to an ExecutionContext some basic flags
// pertaining to the enabled/disabled state of any platform API features which
// are gated behind a ContextEnabled extended attribute in IDL.
class CORE_EXPORT ContextFeatureSettings final
: public GarbageCollectedFinalized<ContextFeatureSettings>,
public Supplement<ExecutionContext> {
static const char kSupplementName[];
enum class CreationMode { kCreateIfNotExists, kDontCreateIfNotExists };
explicit ContextFeatureSettings(ExecutionContext&);
// Returns the ContextFeatureSettings for an ExecutionContext. If one does not
// already exist for the given context, one is created.
static ContextFeatureSettings* From(ExecutionContext*, CreationMode);
// ContextEnabled=MojoJS feature
void enableMojoJS(bool enable) { enable_mojo_js_ = enable; }
bool isMojoJSEnabled() const { return enable_mojo_js_; }
void Trace(blink::Visitor*) override;
bool enable_mojo_js_ = false;
} // namespace blink