mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 8cb76f56 (#307671)
- Linux/Mac: Load V8 initial snapshot from external bin files (see http://crbug.com/421063). - Windows: 8.1 SDK is now required (issue #1470). - Remove CefDOMDocument::GetSelectionStartNode and GetSelectionEndNode methods(see https://codereview.chromium.org/763043004). - Rename internal namespace used in base headers to avoid linker conflicts with cef_sandbox.lib. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1956 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@@ -94,16 +95,12 @@ void CefDevToolsFrontend::RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
if (!frontend_host_) {
|
||||
frontend_host_.reset(
|
||||
content::DevToolsFrontendHost::Create(render_view_host, this));
|
||||
content::DevToolsFrontendHost::Create(
|
||||
web_contents()->GetMainFrame(), this));
|
||||
agent_host_->AttachClient(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DocumentOnLoadCompletedInMainFrame() {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(
|
||||
base::ASCIIToUTF16("InspectorFrontendAPI.setUseSoftMenu(true);"));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
agent_host_->DetachClient();
|
||||
delete this;
|
||||
@@ -112,30 +109,31 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
const std::string& message) {
|
||||
std::string method;
|
||||
std::string browser_message;
|
||||
int id = 0;
|
||||
|
||||
base::ListValue* params = NULL;
|
||||
base::DictionaryValue* dict = NULL;
|
||||
scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
|
||||
if (!parsed_message ||
|
||||
!parsed_message->GetAsDictionary(&dict) ||
|
||||
!dict->GetString("method", &method) ||
|
||||
!dict->GetList("params", ¶ms)) {
|
||||
!dict->GetString("method", &method)) {
|
||||
return;
|
||||
}
|
||||
dict->GetList("params", ¶ms);
|
||||
|
||||
std::string browser_message;
|
||||
if (method == "sendMessageToBrowser" && params &&
|
||||
params->GetSize() == 1 && params->GetString(0, &browser_message)) {
|
||||
agent_host_->DispatchProtocolMessage(browser_message);
|
||||
} else if (method == "loadCompleted") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(
|
||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (method != "sendMessageToBrowser" ||
|
||||
params->GetSize() != 1 ||
|
||||
!params->GetString(0, &browser_message)) {
|
||||
return;
|
||||
}
|
||||
dict->GetInteger("id", &id);
|
||||
|
||||
agent_host_->DispatchProtocolMessage(browser_message);
|
||||
|
||||
if (id) {
|
||||
std::string code = "InspectorFrontendAPI.embedderMessageAck(" +
|
||||
std::string code = "DevToolsAPI.embedderMessageAck(" +
|
||||
base::IntToString(id) + ",\"\");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
@@ -150,7 +148,10 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) {
|
||||
std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");";
|
||||
base::StringValue message_value(message);
|
||||
std::string param;
|
||||
base::JSONWriter::Write(&message_value, ¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
}
|
||||
|
Reference in New Issue
Block a user