cef/libcef/common/widevine_loader.h
Marshall Greenblatt 84f3ff2afd Rename the current CEF runtime to Alloy (see issue #2969)
As part of introducing the Chrome runtime we now need to distinguish
between the classes that implement the current CEF runtime and the
classes the implement the shared CEF library/runtime structure and
public API. We choose the name Alloy for the current CEF runtime
because it describes a combination of Chrome and other elements.

Shared CEF library/runtime classes will continue to use the Cef
prefix. Classes that implement the Alloy or Chrome runtime will use
the Alloy or Chrome prefixes respectively. Classes that extend an
existing Chrome-prefixed class will add the Cef or Alloy suffix,
thereby following the existing naming pattern of Chrome-derived
classes.

This change applies the new naming pattern to an initial set of
runtime-related classes. Additional classes/files will be renamed
and moved as the Chrome runtime implementation progresses.
2020-06-29 16:17:41 -04:00

71 lines
2.0 KiB
C++

// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
#define CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
#pragma once
#include "build/build_config.h"
#include "media/media_buildflags.h"
#include "third_party/widevine/cdm/buildflags.h"
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
#include <vector>
#include "include/cef_web_plugin.h"
#include "base/lazy_instance.h"
namespace content {
struct CdmInfo;
}
namespace media {
struct CdmHostFilePath;
}
class CefWidevineLoader {
public:
// Returns the singleton instance of this object.
static CefWidevineLoader* GetInstance();
// Load the Widevine CDM. May be called before or after context creation. See
// comments in cef_web_plugin.h.
void LoadWidevineCdm(const base::FilePath& path,
CefRefPtr<CefRegisterCdmCallback> callback);
// Plugin registration is triggered here if LoadWidevineCdm() was called
// before context creation.
void OnContextInitialized();
#if defined(OS_LINUX)
// The zygote process which is used when the sandbox is enabled on Linux
// requires early loading of CDM modules. Other processes will receive
// load notification in the usual way.
// Called from AlloyContentClient::AddContentDecryptionModules.
static void AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths);
const base::FilePath& path() { return path_; }
#endif
private:
friend struct base::LazyInstanceTraitsBase<CefWidevineLoader>;
// Members are only accessed before context initialization or on the UI
// thread.
bool load_pending_ = false;
base::FilePath path_;
CefRefPtr<CefRegisterCdmCallback> callback_;
CefWidevineLoader();
~CefWidevineLoader();
};
#endif // BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
#endif // CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_