| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/common/url_request_struct_traits.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace mojo { |
| 10 |
| 11 content::mojom::RequestPriority |
| 12 EnumTraits<content::mojom::RequestPriority, net::RequestPriority>::ToMojom( |
| 13 net::RequestPriority priority) { |
| 14 switch (priority) { |
| 15 case net::THROTTLED: |
| 16 return content::mojom::RequestPriority::kThrottled; |
| 17 case net::IDLE: |
| 18 return content::mojom::RequestPriority::kIdle; |
| 19 case net::LOWEST: |
| 20 return content::mojom::RequestPriority::kLowest; |
| 21 case net::LOW: |
| 22 return content::mojom::RequestPriority::kLow; |
| 23 case net::MEDIUM: |
| 24 return content::mojom::RequestPriority::kMedium; |
| 25 case net::HIGHEST: |
| 26 return content::mojom::RequestPriority::kHighest; |
| 27 } |
| 28 NOTREACHED(); |
| 29 return static_cast<content::mojom::RequestPriority>(priority); |
| 30 } |
| 31 |
| 32 bool EnumTraits<content::mojom::RequestPriority, net::RequestPriority>:: |
| 33 FromMojom(content::mojom::RequestPriority in, net::RequestPriority* out) { |
| 34 switch (in) { |
| 35 case content::mojom::RequestPriority::kThrottled: |
| 36 *out = net::THROTTLED; |
| 37 return true; |
| 38 case content::mojom::RequestPriority::kIdle: |
| 39 *out = net::IDLE; |
| 40 return true; |
| 41 case content::mojom::RequestPriority::kLowest: |
| 42 *out = net::LOWEST; |
| 43 return true; |
| 44 case content::mojom::RequestPriority::kLow: |
| 45 *out = net::LOW; |
| 46 return true; |
| 47 case content::mojom::RequestPriority::kMedium: |
| 48 *out = net::MEDIUM; |
| 49 return true; |
| 50 case content::mojom::RequestPriority::kHighest: |
| 51 *out = net::HIGHEST; |
| 52 return true; |
| 53 } |
| 54 |
| 55 NOTREACHED(); |
| 56 *out = static_cast<net::RequestPriority>(in); |
| 57 return true; |
| 58 } |
| 59 |
| 60 } // namespace mojo |
| OLD | NEW |