diff options
author | Michael BrĂ¼ning <michael.bruning@digia.com> | 2014-04-14 16:07:51 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-14 18:17:22 +0200 |
commit | 1a66aba6aae45292c7fdd88c985ce1122e8e58dc (patch) | |
tree | ef3bb11c9e5530550f59ab057d7bee736c29c5a4 /src/core/web_contents_delegate_qt.cpp | |
parent | aff45885400cd068fbf438a941736841e41607b4 (diff) | |
download | qtwebengine-1a66aba6aae45292c7fdd88c985ce1122e8e58dc.tar.gz |
Map Javascript console message level to enum values.
Translates the internally used LogSeverity values to
enums defined by the QtWebEngine integration layer.
Change-Id: I7da0983d4fb5c199e1a2436b5899a43cf6698784
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 80b2330a8..dba63296b 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -54,6 +54,17 @@ #include "content/public/common/favicon_url.h" #include "content/public/common/file_chooser_params.h" + +// Maps the LogSeverity defines in base/logging.h to the web engines message levels. +static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptConsoleMessageLevel(int32 messageLevel) { + if (messageLevel < 1) + return WebContentsAdapterClient::Info; + else if (messageLevel > 1) + return WebContentsAdapterClient::Error; + + return WebContentsAdapterClient::Warning; +} + WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents, WebContentsAdapterClient *adapterClient) : m_viewClient(adapterClient) { @@ -188,7 +199,7 @@ void WebContentsDelegateQt::RunFileChooser(content::WebContents *web_contents, c bool WebContentsDelegateQt::AddMessageToConsole(content::WebContents *source, int32 level, const base::string16 &message, int32 line_no, const base::string16 &source_id) { Q_UNUSED(source) - m_viewClient->javaScriptConsoleMessage(static_cast<int>(level), toQt(message), static_cast<int>(line_no), toQt(source_id)); + m_viewClient->javaScriptConsoleMessage(mapToJavascriptConsoleMessageLevel(level), toQt(message), static_cast<int>(line_no), toQt(source_id)); return false; } |