Print console output of devtools.

This commit is contained in:
Cheng Zhao 2014-08-28 12:53:35 +08:00
parent 3872db20d8
commit 47bc6a29a7
2 changed files with 16 additions and 0 deletions

View file

@ -336,6 +336,17 @@ void InspectableWebContentsImpl::WebContentsDestroyed() {
frontend_host_.reset();
}
bool InspectableWebContentsImpl::AddMessageToConsole(
content::WebContents* source,
int32 level,
const base::string16& message,
int32 line_no,
const base::string16& source_id) {
logging::LogMessage("CONSOLE", line_no, level).stream() << "\"" <<
message << "\", source: " << source_id << " (" << line_no << ")";
return true;
}
void InspectableWebContentsImpl::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {

View file

@ -107,6 +107,11 @@ class InspectableWebContentsImpl :
// content::WebContentsDelegate
virtual bool AddMessageToConsole(content::WebContents* source,
int32 level,
const base::string16& message,
int32 line_no,
const base::string16& source_id) OVERRIDE;
virtual void HandleKeyboardEvent(
content::WebContents*, const content::NativeWebKeyboardEvent&) OVERRIDE;
virtual void CloseContents(content::WebContents* source) OVERRIDE;