1 // Copyright (c) 2012 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.
5 #include "ppapi/proxy/serialized_structs.h"
7 #include "base/pickle.h"
8 #include "build/build_config.h"
9 #include "ppapi/c/dev/ppb_font_dev.h"
10 #include "ppapi/c/pp_file_info.h"
11 #include "ppapi/c/pp_rect.h"
12 #include "ppapi/c/trusted/ppb_browser_font_trusted.h"
13 #include "ppapi/shared_impl/var.h"
18 SerializedFontDescription::SerializedFontDescription()
29 SerializedFontDescription::~SerializedFontDescription() {}
31 void SerializedFontDescription::SetFromPPFontDescription(
32 const PP_FontDescription_Dev
& desc
) {
33 StringVar
* string_var
= StringVar::FromPPVar(desc
.face
);
34 face
= string_var
? string_var
->value() : std::string();
40 small_caps
= desc
.small_caps
;
41 letter_spacing
= desc
.letter_spacing
;
42 word_spacing
= desc
.word_spacing
;
45 void SerializedFontDescription::SetFromPPBrowserFontDescription(
46 const PP_BrowserFont_Trusted_Description
& desc
) {
47 StringVar
* string_var
= StringVar::FromPPVar(desc
.face
);
48 face
= string_var
? string_var
->value() : std::string();
54 small_caps
= desc
.small_caps
;
55 letter_spacing
= desc
.letter_spacing
;
56 word_spacing
= desc
.word_spacing
;
59 void SerializedFontDescription::SetToPPFontDescription(
60 PP_FontDescription_Dev
* desc
) const {
61 desc
->face
= StringVar::StringToPPVar(face
);
62 desc
->family
= static_cast<PP_FontFamily_Dev
>(family
);
64 desc
->weight
= static_cast<PP_FontWeight_Dev
>(weight
);
65 desc
->italic
= italic
;
66 desc
->small_caps
= small_caps
;
67 desc
->letter_spacing
= letter_spacing
;
68 desc
->word_spacing
= word_spacing
;
71 void SerializedFontDescription::SetToPPBrowserFontDescription(
72 PP_BrowserFont_Trusted_Description
* desc
) const {
73 desc
->face
= StringVar::StringToPPVar(face
);
74 desc
->family
= static_cast<PP_BrowserFont_Trusted_Family
>(family
);
76 desc
->weight
= static_cast<PP_BrowserFont_Trusted_Weight
>(weight
);
77 desc
->italic
= italic
;
78 desc
->small_caps
= small_caps
;
79 desc
->letter_spacing
= letter_spacing
;
80 desc
->word_spacing
= word_spacing
;
83 SerializedNetworkInfo::SerializedNetworkInfo()
84 : type(PP_NETWORKLIST_TYPE_UNKNOWN
),
85 state(PP_NETWORKLIST_STATE_DOWN
),
89 SerializedNetworkInfo::~SerializedNetworkInfo() {}
91 SerializedTrueTypeFontDesc::SerializedTrueTypeFontDesc()
100 SerializedTrueTypeFontDesc::~SerializedTrueTypeFontDesc() {}
102 void SerializedTrueTypeFontDesc::SetFromPPTrueTypeFontDesc(
103 const PP_TrueTypeFontDesc_Dev
& desc
) {
104 StringVar
* string_var
= StringVar::FromPPVar(desc
.family
);
105 family
= string_var
? string_var
->value() : std::string();
107 generic_family
= desc
.generic_family
;
109 weight
= desc
.weight
;
111 charset
= desc
.charset
;
114 void SerializedTrueTypeFontDesc::CopyToPPTrueTypeFontDesc(
115 PP_TrueTypeFontDesc_Dev
* desc
) const {
116 desc
->family
= StringVar::StringToPPVar(family
);
118 desc
->generic_family
= generic_family
;
120 desc
->weight
= weight
;
122 desc
->charset
= charset
;
125 PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params()
131 clip
.size
.height
= 0;
135 allow_subpixel_aa
= PP_FALSE
;
138 PPBFlash_DrawGlyphs_Params::~PPBFlash_DrawGlyphs_Params() {}