Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 4a1b6f93e2d16a899f2d54a0f0c1a2ffc38e3a16..0fb01683b6420bfc4c797a8e421669ca97ba5190 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -164,6 +164,7 @@ |
| #include "third_party/WebKit/public/platform/WebVector.h" |
| #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h" |
| #include "third_party/WebKit/public/web/WebColorSuggestion.h" |
| +#include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| #include "third_party/WebKit/public/web/WebDocument.h" |
| #include "third_party/WebKit/public/web/WebFindOptions.h" |
| #include "third_party/WebKit/public/web/WebFrameSerializer.h" |
| @@ -793,6 +794,22 @@ bool UseMojoCdm() { |
| } |
| #endif // defined(ENABLE_MOJO_CDM) |
| +blink::WebConsoleMessage::Level TranslateConsoleLevel( |
| + const ConsoleMessageLevel level) { |
| + switch (level) { |
| + case CONSOLE_MESSAGE_LEVEL_DEBUG: |
|
dcheng
2016/04/14 17:29:11
Why can't we just use the blink public API enum di
carlosk
2016/04/15 09:42:43
I am unable to answer that question as I'm not awa
|
| + return blink::WebConsoleMessage::LevelDebug; |
| + case CONSOLE_MESSAGE_LEVEL_LOG: |
| + return blink::WebConsoleMessage::LevelLog; |
| + case CONSOLE_MESSAGE_LEVEL_WARNING: |
| + return blink::WebConsoleMessage::LevelWarning; |
| + case CONSOLE_MESSAGE_LEVEL_ERROR: |
| + return blink::WebConsoleMessage::LevelError; |
| + } |
| + NOTREACHED(); |
| + return blink::WebConsoleMessage::LevelLog; |
| +} |
| + |
| } // namespace |
| // static |
| @@ -1409,6 +1426,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
| OnExecuteNoValueEditCommand) |
| IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
| IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) |
| + IPC_MESSAGE_HANDLER(FrameMsg_AddSecurityMessageToConsole, |
| + OnAddSecurityMessageToConsole) |
| IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
| OnJavaScriptExecuteRequest) |
| IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
| @@ -1798,6 +1817,15 @@ void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, |
| AddMessageToConsole(level, message); |
| } |
| +void RenderFrameImpl::OnAddSecurityMessageToConsole( |
| + ConsoleMessageLevel level, |
| + const std::string& message) { |
| + blink::WebConsoleMessage wcm(TranslateConsoleLevel(level), |
| + WebString::fromUTF8(message)); |
| + wcm.source = blink::WebConsoleMessage::SourceSecurity; |
| + frame_->addMessageToConsole(wcm); |
| +} |
| + |
| void RenderFrameImpl::OnJavaScriptExecuteRequest( |
| const base::string16& jscript, |
| int id, |
| @@ -2359,8 +2387,11 @@ void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable( |
| void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, |
| const std::string& message) { |
| - if (devtools_agent_) |
| - devtools_agent_->AddMessageToConsole(level, message); |
| + if (devtools_agent_) { |
| + blink::WebConsoleMessage wcm(TranslateConsoleLevel(level), |
| + WebString::fromUTF8(message)); |
| + frame_->addMessageToConsole(wcm); |
| + } |
| } |
| bool RenderFrameImpl::IsUsingLoFi() const { |