| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "third_party/WebKit/public/web/ConsoleMessageStructTraits.h" | 5 #include "third_party/WebKit/public/web/ConsoleMessageStructTraits.h" |
| 6 | 6 |
| 7 #include "third_party/WebKit/public/platform/WebString.h" | 7 #include "third_party/WebKit/public/platform/WebString.h" |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 | 10 |
| 11 // Ensure that the WebConsoleMessage::Level enum values stay in sync with the | 11 // Ensure that the WebConsoleMessage::Level enum values stay in sync with the |
| 12 // mojom::ConsoleMessageLevel. | 12 // mojom::ConsoleMessageLevel. |
| 13 #define STATIC_ASSERT_ENUM(a, b) \ | 13 #define STATIC_ASSERT_ENUM(a, b) \ |
| 14 static_assert(static_cast<int>(a) == static_cast<int>(b), \ | 14 static_assert(static_cast<int>(a) == static_cast<int>(b), \ |
| 15 "mismatching enum : " #a) | 15 "mismatching enum : " #a) |
| 16 | 16 |
| 17 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelDebug, | 17 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelVerbose, |
| 18 ::blink::mojom::ConsoleMessageLevel::Debug); | 18 ::blink::mojom::ConsoleMessageLevel::Verbose); |
| 19 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelLog, | |
| 20 ::blink::mojom::ConsoleMessageLevel::Log); | |
| 21 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelInfo, | 19 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelInfo, |
| 22 ::blink::mojom::ConsoleMessageLevel::Info); | 20 ::blink::mojom::ConsoleMessageLevel::Info); |
| 23 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelWarning, | 21 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelWarning, |
| 24 ::blink::mojom::ConsoleMessageLevel::Warning); | 22 ::blink::mojom::ConsoleMessageLevel::Warning); |
| 25 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelError, | 23 STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::LevelError, |
| 26 ::blink::mojom::ConsoleMessageLevel::Error); | 24 ::blink::mojom::ConsoleMessageLevel::Error); |
| 27 | 25 |
| 28 // static | 26 // static |
| 29 ::blink::mojom::ConsoleMessageLevel | 27 ::blink::mojom::ConsoleMessageLevel |
| 30 EnumTraits<::blink::mojom::ConsoleMessageLevel, | 28 EnumTraits<::blink::mojom::ConsoleMessageLevel, |
| 31 ::blink::WebConsoleMessage::Level>:: | 29 ::blink::WebConsoleMessage::Level>:: |
| 32 ToMojom(::blink::WebConsoleMessage::Level level) { | 30 ToMojom(::blink::WebConsoleMessage::Level level) { |
| 33 return static_cast<::blink::mojom::ConsoleMessageLevel>(level); | 31 return static_cast<::blink::mojom::ConsoleMessageLevel>(level); |
| 34 } | 32 } |
| 35 | 33 |
| 36 // static | 34 // static |
| 37 bool EnumTraits<::blink::mojom::ConsoleMessageLevel, | 35 bool EnumTraits<::blink::mojom::ConsoleMessageLevel, |
| 38 ::blink::WebConsoleMessage::Level>:: | 36 ::blink::WebConsoleMessage::Level>:: |
| 39 FromMojom(::blink::mojom::ConsoleMessageLevel in, | 37 FromMojom(::blink::mojom::ConsoleMessageLevel in, |
| 40 ::blink::WebConsoleMessage::Level* out) { | 38 ::blink::WebConsoleMessage::Level* out) { |
| 41 *out = static_cast<::blink::WebConsoleMessage::Level>(in); | 39 *out = static_cast<::blink::WebConsoleMessage::Level>(in); |
| 42 return true; | 40 return true; |
| 43 } | 41 } |
| 44 | 42 |
| 45 } // namespace mojo | 43 } // namespace mojo |
| OLD | NEW |