Update cef3 artifacts

This commit is contained in:
Kevin Sawicki
2012-09-13 13:38:25 -07:00
parent 6cd601b17f
commit c53ee5032d
19 changed files with 384 additions and 54 deletions

View File

@@ -0,0 +1,44 @@
#include "atom_handler.h"
#include "include/cef_base.h"
#include "include/cef_runnable.h"
#include <iostream>
#include <stdlib.h>
#include "io_utils.h"
#include "message_translation.h"
using namespace std;
AtomHandler::AtomHandler() :
CefV8Handler() {
string realFilePath = io_utils_real_app_path("/native/v8_extensions/atom.js");
if (!realFilePath.empty()) {
string extensionCode;
if (io_utils_read(realFilePath, &extensionCode) > 0)
CefRegisterExtension("v8/atom", extensionCode, this);
}
}
bool AtomHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exception) {
CefRefPtr<CefBrowser> browser =
CefV8Context::GetCurrentContext()->GetBrowser();
if (name == "sendMessageToBrowserProcess") {
if (arguments.size() == 0 || !arguments[0]->IsString()) {
exception = "You must supply a message name";
return false;
}
CefString name = arguments[0]->GetStringValue();
CefRefPtr<CefProcessMessage> message = CefProcessMessage::Create(name);
if (arguments.size() > 1 && arguments[1]->IsArray()) {
TranslateList(arguments[1], message->GetArgumentList());
}
browser->SendProcessMessage(PID_BROWSER, message);
return true;
}
return false;
}