1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/base/android/ANPNativeWindow.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// must include config.h first for webkit to fiddle with new/delete 1.10 +#include <android/log.h> 1.11 +#include "AndroidBridge.h" 1.12 +#include "ANPBase.h" 1.13 +#include "nsIPluginInstanceOwner.h" 1.14 +#include "nsPluginInstanceOwner.h" 1.15 +#include "nsNPAPIPluginInstance.h" 1.16 +#include "gfxRect.h" 1.17 + 1.18 +using namespace mozilla; 1.19 +using namespace mozilla; 1.20 + 1.21 +#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args) 1.22 +#define ASSIGN(obj, name) (obj)->name = anp_native_window_##name 1.23 + 1.24 +static ANPNativeWindow anp_native_window_acquireNativeWindow(NPP instance) { 1.25 + nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata); 1.26 + return pinst->AcquireContentWindow(); 1.27 +} 1.28 + 1.29 +static void anp_native_window_invertPluginContent(NPP instance, bool isContentInverted) { 1.30 + nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata); 1.31 + pinst->SetInverted(isContentInverted); 1.32 + pinst->RedrawPlugin(); 1.33 +} 1.34 + 1.35 + 1.36 +void InitNativeWindowInterface(ANPNativeWindowInterfaceV0* i) { 1.37 + ASSIGN(i, acquireNativeWindow); 1.38 + ASSIGN(i, invertPluginContent); 1.39 +}