| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/translate/content/common/translate_struct_traits.h" | 5 #include "components/translate/content/common/translate_struct_traits.h" |
| 6 | 6 |
| 7 #include "ipc/ipc_message_utils.h" | 7 #include "ipc/ipc_message_utils.h" |
| 8 #include "url/mojo/url_gurl_struct_traits.h" | 8 #include "url/mojo/url_gurl_struct_traits.h" |
| 9 | 9 |
| 10 using namespace translate; | 10 using namespace translate; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 case mojom::TranslateError::TRANSLATE_ERROR_MAX: | 85 case mojom::TranslateError::TRANSLATE_ERROR_MAX: |
| 86 *output = TranslateErrors::Type::TRANSLATE_ERROR_MAX; | 86 *output = TranslateErrors::Type::TRANSLATE_ERROR_MAX; |
| 87 return true; | 87 return true; |
| 88 } | 88 } |
| 89 | 89 |
| 90 NOTREACHED(); | 90 NOTREACHED(); |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 bool StructTraits<mojom::LanguageDetectionDetails, LanguageDetectionDetails>:: | 95 bool StructTraits<mojom::LanguageDetectionDetailsDataView, |
| 96 LanguageDetectionDetails>:: |
| 96 Read(mojom::LanguageDetectionDetailsDataView data, | 97 Read(mojom::LanguageDetectionDetailsDataView data, |
| 97 LanguageDetectionDetails* out) { | 98 LanguageDetectionDetails* out) { |
| 98 if (!data.ReadTime(&out->time)) | 99 if (!data.ReadTime(&out->time)) |
| 99 return false; | 100 return false; |
| 100 if (!data.ReadUrl(&out->url)) | 101 if (!data.ReadUrl(&out->url)) |
| 101 return false; | 102 return false; |
| 102 if (!data.ReadContentLanguage(&out->content_language)) | 103 if (!data.ReadContentLanguage(&out->content_language)) |
| 103 return false; | 104 return false; |
| 104 if (!data.ReadCldLanguage(&out->cld_language)) | 105 if (!data.ReadCldLanguage(&out->cld_language)) |
| 105 return false; | 106 return false; |
| 106 | 107 |
| 107 out->is_cld_reliable = data.is_cld_reliable(); | 108 out->is_cld_reliable = data.is_cld_reliable(); |
| 108 out->has_notranslate = data.has_notranslate(); | 109 out->has_notranslate = data.has_notranslate(); |
| 109 | 110 |
| 110 if (!data.ReadHtmlRootLanguage(&out->html_root_language)) | 111 if (!data.ReadHtmlRootLanguage(&out->html_root_language)) |
| 111 return false; | 112 return false; |
| 112 if (!data.ReadAdoptedLanguage(&out->adopted_language)) | 113 if (!data.ReadAdoptedLanguage(&out->adopted_language)) |
| 113 return false; | 114 return false; |
| 114 if (!data.ReadContents(&out->contents)) | 115 if (!data.ReadContents(&out->contents)) |
| 115 return false; | 116 return false; |
| 116 | 117 |
| 117 return true; | 118 return true; |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace mojo | 121 } // namespace mojo |
| OLD | NEW |