Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: components/translate/content/common/translate_struct_traits.h

Issue 2253293002: Mojo C++ bindings: change the first template parameter of StructTraits and UnionTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@91_extra
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_TRANSLATE_CONTENT_COMMON_TRANSLATE_STRUCT_TRAITS_H_ 5 #ifndef COMPONENTS_TRANSLATE_CONTENT_COMMON_TRANSLATE_STRUCT_TRAITS_H_
6 #define COMPONENTS_TRANSLATE_CONTENT_COMMON_TRANSLATE_STRUCT_TRAITS_H_ 6 #define COMPONENTS_TRANSLATE_CONTENT_COMMON_TRANSLATE_STRUCT_TRAITS_H_
7 7
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "components/translate/content/common/translate.mojom.h" 10 #include "components/translate/content/common/translate.mojom.h"
11 #include "components/translate/core/common/language_detection_details.h" 11 #include "components/translate/core/common/language_detection_details.h"
12 #include "components/translate/core/common/translate_errors.h" 12 #include "components/translate/core/common/translate_errors.h"
13 #include "mojo/public/cpp/bindings/struct_traits.h" 13 #include "mojo/public/cpp/bindings/struct_traits.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 16
17 template <> 17 template <>
18 struct EnumTraits<translate::mojom::TranslateError, 18 struct EnumTraits<translate::mojom::TranslateError,
19 translate::TranslateErrors::Type> { 19 translate::TranslateErrors::Type> {
20 static translate::mojom::TranslateError ToMojom( 20 static translate::mojom::TranslateError ToMojom(
21 translate::TranslateErrors::Type input); 21 translate::TranslateErrors::Type input);
22 static bool FromMojom(translate::mojom::TranslateError input, 22 static bool FromMojom(translate::mojom::TranslateError input,
23 translate::TranslateErrors::Type* output); 23 translate::TranslateErrors::Type* output);
24 }; 24 };
25 25
26 template <> 26 template <>
27 struct StructTraits<translate::mojom::LanguageDetectionDetails, 27 struct StructTraits<translate::mojom::LanguageDetectionDetailsDataView,
28 translate::LanguageDetectionDetails> { 28 translate::LanguageDetectionDetails> {
29 static const base::Time& time(const translate::LanguageDetectionDetails& r) { 29 static const base::Time& time(const translate::LanguageDetectionDetails& r) {
30 return r.time; 30 return r.time;
31 } 31 }
32 32
33 static const GURL& url(const translate::LanguageDetectionDetails& r) { 33 static const GURL& url(const translate::LanguageDetectionDetails& r) {
34 return r.url; 34 return r.url;
35 } 35 }
36 36
37 static const std::string& content_language( 37 static const std::string& content_language(
(...skipping 29 matching lines...) Expand all
67 return r.contents; 67 return r.contents;
68 } 68 }
69 69
70 static bool Read(translate::mojom::LanguageDetectionDetailsDataView data, 70 static bool Read(translate::mojom::LanguageDetectionDetailsDataView data,
71 translate::LanguageDetectionDetails* out); 71 translate::LanguageDetectionDetails* out);
72 }; 72 };
73 73
74 } // namespace mojo 74 } // namespace mojo
75 75
76 #endif // COMPONENTS_TRANSLATE_CONTENT_COMMON_TRANSLATE_STRUCT_TRAITS_H_ 76 #endif // COMPONENTS_TRANSLATE_CONTENT_COMMON_TRANSLATE_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698