How to interact with DOM without Javascript? - google-chrome

How can I interact with DOM in either CEF or Awesomium without using Javascript? Why do we have to use Javascript just to interact with DOM?

CEF
While CEF allows access to the DOM via it's CefDOMVisitor, CefDOMDocument, CefDOMNode, CefDOMEvent and CefDOMEventListener declared in cef_dom.h, chief contributor Marshall Greenblatt confirms here that it is meant for read only access:
The DOM API exposed by Chromium is read-only with the exception of
adding listeners. CEF exposes this same API via the CefFrame::VisitDOM
method. If you want to manipulate the DOM directly via C++ it will be
necessary to use WebKit interfaces directly.
So, if you'd like full access similar to IHtmlElement, you might have to use Webkit directly...

Related

How to activate IWiFiDirectDevice in Win32 Console APP using WRL?

I want to use WinRT API for WiFi Direct from Windows 10 SDK in Win32 Console Application. I know about C++/CX (and even made some progress going that way), but still want to make it work without this extension.
My problem is that I can't activate IWifiDirectDevice interface (from ABI::Windows::Devices::WiFiDirect) to access IWifiDirectDeviceStatics that provides an GetDeviceSelector method.
HStringReference strDevice(RuntimeClass_Windows_Devices_WiFiDirect_WiFiDirectDevice);
ComPtr<IInspectable> insp;
hr = RoActivateInstance(strDevice.Get(), insp.GetAddressOf());
This code ends up with E_NOTIMPL as a result. In Microsoft's example they used factories for activation, but ABI::Windows::Devices::WiFiDirect namespace has no factories.
Worth mentioning that IWifiDirectAdvertisementPublisher works just fine when activated the way I wrote before.
So how to activate IWifiDirectDevice from WRL?
Windows.Devices.WiFiDirect.WiFiDirectDevice is not an activatable class. You can see that by looking at windows.devices.wifidirect.idl.
You will need to use the static methods, e.g.:
HStringReference strDevice(RuntimeClass_Windows_Devices_WiFiDirect_WiFiDirectDevice);
ComPtr<IWiFiDirectDeviceStatics> wiFiDirectDeviceStatics;
hr = Windows::Foundation::GetActivationFactory(
strDevice.Get(),
&wiFiDirectDeviceStatics);
ComPtr<IWiFiDirectDevice> wiFiDirectDevice;
ComPtr<IAsyncOperation<WiFiDirectDevice*>> asyncOperation;
hr = wiFiDirectDeviceStatics->FromIdAsync(deviceId.Get(), &asyncOperation);
Consider taking a look at the Wi-Fi Direct sample.

Can an embedded cocos2d-js app call back out to c++?

I'm researching the possibility of using cocos2d-js by embedding it as a view inside an existing iOS app. In order to make this work, I'm going to need 2-way communication between cocos2d and the surrounding application.
After some initial investigation, I have determined that it is possible to call in to cocos using ScriptingCore:
ScriptingCore* sc = ScriptingCore::getInstance();
jsval outVal;
sc->evalString("function()", &outVal);
My question, then, is around doing the reverse. It is possible to (e.g. in response to user input) call back out of cocos2d-js to C++? Ideally, there would be a way to register a callback with ScriptingCore which could be invoked from JavaScript.
I believe it can be done, but I have not tried myself, nor can I find a good and concise example.
All I can do is point you at SuperSuraccoon's Bluetooth example and it's git page, which apparently does both ways communication between C++ and JS code.

NaCLl Change Browser Interface

Google's NaCL OpenGL demo uses the "Pure" OpenGLES function calls. However, I'd like to play around with the Pepper OpenGL interface.
The problem I'm having is that the Google demo initializes the PPB Graphic Interface from the browser calling
ppb_g3d_interface = (PPB_Graphics3D*)get_browser(PPB_GRAPHICS_3D_INTERFACE);
In my case, this seems to be returning an instance of PPB_Graphics3D_1_0 and not an OpenGLES interface. Is there anyway to set Chrome use the OpenGLES interface at launch or from within the NaCL code?
The interface you're looking for is PPB_OpenGLES2. It can be found in $NACL_SDK_ROOT/include/ppapi/c/ppb_opengles2.h.
You can use it like this:
ppb_opengles_interface = (PPB_OpenGLES2*)get_browser(PPB_OPENGLES2_INTERFACE);
See the auto-generated documentation for it here:
https://developers.google.com/native-client/pepperc/struct_p_p_b___open_g_l_e_s2
The source for the "extension library" described in your link is also available in the SDK. You can look at the source for it in $NACL_SDK_ROOT/src/ppapi_gles2.

Does the Flex SOAP WebService dispatch ProgressEvents?

I'm currently building an application that will use a few SOAP web services. I've gotten them all to work just fine using the mx.rpc.soap.WebService class, but now I am seeing designs for the first time and they require a progress bar. Looking through the mx.rpc live docs, I have not found anything that resembles a ProgressEvent for this package. Is a ProgressEvent (or something similar) dispatched by these classes?

Websocket and Java Swing front end

Is it doable to make Websocket interfaced with Java Swing front end? If so how?
Try mine:
http://github.com/TooTallNate/Java-WebSocket
Contains a Client and Server implementation. In the example folder there's a simple JFrame subclass called ChatClient. Look at it's source for a Swing reference.
Essentially you just need to subclass net.tootallnate.websocket.WebSocketClient and implement the onOpen, onClose, and onMessage methods. The class has an interface very similarly to the WebSockets API for HTML5.
Kaazing WebSocket Gateway ships with support for JavaScript, Flex, Silverlight, but also native Java clients (stand alone as well as applets). For more information, check out
http://tech.kaazing.com/documentation/index.html