1785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung// Use of this source code is governed by a BSD-style license that can be 3785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung// found in the LICENSE file. 4785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 5785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung#ifndef PPAPI_CPP_MODULE_EMBEDDER_H_ 6785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung#define PPAPI_CPP_MODULE_EMBEDDER_H_ 7785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 8785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung#include "ppapi/c/ppp.h" 9785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 10785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// @file 11785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// This file defines the APIs for creating a Module object. 12785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chungnamespace pp { 13785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 14785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chungclass Module; 15785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 16785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// This function creates the <code>pp::Module</code> object associated with 17785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// this module. 18785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// 1955b6550e37da5df2fda44fc712bc082731f2d8e7Winson Chung/// <strong>Note: </strong>NaCl module developers must implement this function. 20d2e87b32dc8c09590dd1ae186e97d3260955a568Winson Chung/// 21ed66b2bac7447febe2e405b4ce725cae4f6b5988Adam Cohen/// @return Returns the module if it was successfully created, or NULL on 22785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// failure. Upon failure, the module will be unloaded. 23785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chungpp::Module* CreateModule(); 24785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 25785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// Sets the get interface function in the broker process. 26785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// 27374753cabf05cde1ad669d07bde47e34fdcbe499Amith Yamasani/// This function is only relevant when you're using the PPB_Broker interface 28374753cabf05cde1ad669d07bde47e34fdcbe499Amith Yamasani/// in a trusted native plugin. In this case, you may need to implement 29785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// PPP_GetInterface when the plugin is loaded in the unsandboxed process. 30785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// Normally the C++ wrappers implement PPP_GetInterface for you but this 31f0ea4d3378be7b962c8e0bce2392df5e82491fb8Winson Chung/// doesn't work in the context of the broker process. 32785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung// 33785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// So if you need to implement PPP_* interfaces in the broker process, call 34785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// this function in your PPP_InitializeBroker implementation which will set 35785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung/// up the given function as implementing PPP_GetInterface. 3605713af127d765cc28a8b2fd548a90347c90d6cbMichael Jurkavoid SetBrokerGetInterfaceFunc(PP_GetInterface_Func broker_get_interface); 37785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung 38785d2eb2b8d7072c8124300dd9168ff51a91cf38Winson Chung} // namespace pp 39b44b52439d155f570db7d6d0b80fdd3350e35685Winson Chung 409e05a5ea951b4d5ffce324da8dd0656353306e6fAdam Cohen#endif // PPAPI_CPP_MODULE_EMBEDDER_H_ 419e05a5ea951b4d5ffce324da8dd0656353306e6fAdam Cohen