| 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 "content/common/push_messaging_param_traits.h" | 5 #include "content/common/push_messaging_param_traits.h" |
| 6 | 6 |
| 7 namespace mojo { | 7 namespace mojo { |
| 8 | 8 |
| 9 // PushRegistrationStatus | 9 // PushRegistrationStatus |
| 10 static_assert( | 10 static_assert( |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 static_assert(blink::WebPushError::ErrorType::ErrorTypeAbort == | 110 static_assert(blink::WebPushError::ErrorType::ErrorTypeAbort == |
| 111 static_cast<blink::WebPushError::ErrorType>( | 111 static_cast<blink::WebPushError::ErrorType>( |
| 112 content::mojom::PushErrorType::ABORT), | 112 content::mojom::PushErrorType::ABORT), |
| 113 "PushErrorType enums must match, ABORT"); | 113 "PushErrorType enums must match, ABORT"); |
| 114 | 114 |
| 115 static_assert(blink::WebPushError::ErrorType::ErrorTypeNetwork == | 115 static_assert(blink::WebPushError::ErrorType::ErrorTypeNetwork == |
| 116 static_cast<blink::WebPushError::ErrorType>( | 116 static_cast<blink::WebPushError::ErrorType>( |
| 117 content::mojom::PushErrorType::NETWORK), | 117 content::mojom::PushErrorType::NETWORK), |
| 118 "PushErrorType enums must match, NETWORK"); | 118 "PushErrorType enums must match, NETWORK"); |
| 119 | 119 |
| 120 static_assert(blink::WebPushError::ErrorType::ErrorTypeNone == |
| 121 static_cast<blink::WebPushError::ErrorType>( |
| 122 content::mojom::PushErrorType::NONE), |
| 123 "PushErrorType enums must match, NONE"); |
| 124 |
| 120 static_assert(blink::WebPushError::ErrorType::ErrorTypeNotAllowed == | 125 static_assert(blink::WebPushError::ErrorType::ErrorTypeNotAllowed == |
| 121 static_cast<blink::WebPushError::ErrorType>( | 126 static_cast<blink::WebPushError::ErrorType>( |
| 122 content::mojom::PushErrorType::NOT_ALLOWED), | 127 content::mojom::PushErrorType::NOT_ALLOWED), |
| 123 "PushErrorType enums must match, NOT_ALLOWED"); | 128 "PushErrorType enums must match, NOT_ALLOWED"); |
| 124 | 129 |
| 125 static_assert(blink::WebPushError::ErrorType::ErrorTypeNotFound == | 130 static_assert(blink::WebPushError::ErrorType::ErrorTypeNotFound == |
| 126 static_cast<blink::WebPushError::ErrorType>( | 131 static_cast<blink::WebPushError::ErrorType>( |
| 127 content::mojom::PushErrorType::NOT_FOUND), | 132 content::mojom::PushErrorType::NOT_FOUND), |
| 128 "PushErrorType enums must match, NOT_FOUND"); | 133 "PushErrorType enums must match, NOT_FOUND"); |
| 129 | 134 |
| 130 static_assert(blink::WebPushError::ErrorType::ErrorTypeNotSupported == | 135 static_assert(blink::WebPushError::ErrorType::ErrorTypeNotSupported == |
| 131 static_cast<blink::WebPushError::ErrorType>( | 136 static_cast<blink::WebPushError::ErrorType>( |
| 132 content::mojom::PushErrorType::NOT_SUPPORTED), | 137 content::mojom::PushErrorType::NOT_SUPPORTED), |
| 133 "PushErrorType enums must match, NOT_SUPPORTED"); | 138 "PushErrorType enums must match, NOT_SUPPORTED"); |
| 134 | 139 |
| 135 static_assert(blink::WebPushError::ErrorType::ErrorTypeUnknown == | |
| 136 static_cast<blink::WebPushError::ErrorType>( | |
| 137 content::mojom::PushErrorType::UNKNOWN), | |
| 138 "PushErrorType enums must match, UNKNOWN"); | |
| 139 | |
| 140 static_assert(blink::WebPushError::ErrorType::ErrorTypeInvalidState == | 140 static_assert(blink::WebPushError::ErrorType::ErrorTypeInvalidState == |
| 141 static_cast<blink::WebPushError::ErrorType>( | 141 static_cast<blink::WebPushError::ErrorType>( |
| 142 content::mojom::PushErrorType::INVALID_STATE), | 142 content::mojom::PushErrorType::INVALID_STATE), |
| 143 "PushErrorType enums must match, INVALID_STATE"); | 143 "PushErrorType enums must match, INVALID_STATE"); |
| 144 | 144 |
| 145 static_assert(blink::WebPushError::ErrorType::ErrorTypeLast == | 145 static_assert(blink::WebPushError::ErrorType::ErrorTypeLast == |
| 146 static_cast<blink::WebPushError::ErrorType>( | 146 static_cast<blink::WebPushError::ErrorType>( |
| 147 content::mojom::PushErrorType::LAST), | 147 content::mojom::PushErrorType::LAST), |
| 148 "PushErrorType enums must match, LAST"); | 148 "PushErrorType enums must match, LAST"); |
| 149 | 149 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // static | 263 // static |
| 264 content::mojom::PushErrorType | 264 content::mojom::PushErrorType |
| 265 EnumTraits<content::mojom::PushErrorType, blink::WebPushError::ErrorType>:: | 265 EnumTraits<content::mojom::PushErrorType, blink::WebPushError::ErrorType>:: |
| 266 ToMojom(blink::WebPushError::ErrorType input) { | 266 ToMojom(blink::WebPushError::ErrorType input) { |
| 267 if (input >= blink::WebPushError::ErrorType::ErrorTypeAbort && | 267 if (input >= blink::WebPushError::ErrorType::ErrorTypeAbort && |
| 268 input <= blink::WebPushError::ErrorType::ErrorTypeInvalidState) { | 268 input <= blink::WebPushError::ErrorType::ErrorTypeInvalidState) { |
| 269 return static_cast<content::mojom::PushErrorType>(input); | 269 return static_cast<content::mojom::PushErrorType>(input); |
| 270 } | 270 } |
| 271 | 271 |
| 272 NOTREACHED(); | 272 NOTREACHED(); |
| 273 return content::mojom::PushErrorType::UNKNOWN; | 273 return content::mojom::PushErrorType::ABORT; |
| 274 } | 274 } |
| 275 | 275 |
| 276 // static | 276 // static |
| 277 bool EnumTraits<content::mojom::PushErrorType, blink::WebPushError::ErrorType>:: | 277 bool EnumTraits<content::mojom::PushErrorType, blink::WebPushError::ErrorType>:: |
| 278 FromMojom(content::mojom::PushErrorType input, | 278 FromMojom(content::mojom::PushErrorType input, |
| 279 blink::WebPushError::ErrorType* output) { | 279 blink::WebPushError::ErrorType* output) { |
| 280 if (input >= content::mojom::PushErrorType::ABORT && | 280 if (input >= content::mojom::PushErrorType::ABORT && |
| 281 input <= content::mojom::PushErrorType::INVALID_STATE) { | 281 input <= content::mojom::PushErrorType::INVALID_STATE) { |
| 282 *output = static_cast<blink::WebPushError::ErrorType>(input); | 282 *output = static_cast<blink::WebPushError::ErrorType>(input); |
| 283 return true; | 283 return true; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 input <= content::mojom::PushPermissionStatus::LAST) { | 341 input <= content::mojom::PushPermissionStatus::LAST) { |
| 342 *output = static_cast<blink::WebPushPermissionStatus>(input); | 342 *output = static_cast<blink::WebPushPermissionStatus>(input); |
| 343 return true; | 343 return true; |
| 344 } | 344 } |
| 345 | 345 |
| 346 NOTREACHED(); | 346 NOTREACHED(); |
| 347 return false; | 347 return false; |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace mojo | 350 } // namespace mojo |
| OLD | NEW |