summaryrefslogtreecommitdiff
path: root/chromium/ppapi/proxy/serialized_structs.cc
blob: c88b70cd42c8aee9d18e663c92e63149c17c288b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ppapi/proxy/serialized_structs.h"

#include "base/pickle.h"
#include "build/build_config.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#include "ppapi/shared_impl/var.h"

namespace ppapi {
namespace proxy {

SerializedFontDescription::SerializedFontDescription()
    : face(),
      family(0),
      size(0),
      weight(0),
      italic(PP_FALSE),
      small_caps(PP_FALSE),
      letter_spacing(0),
      word_spacing(0) {
}

SerializedFontDescription::~SerializedFontDescription() {}

void SerializedFontDescription::SetFromPPBrowserFontDescription(
    const PP_BrowserFont_Trusted_Description& desc) {
  StringVar* string_var = StringVar::FromPPVar(desc.face);
  face = string_var ? string_var->value() : std::string();

  family = desc.family;
  size = desc.size;
  weight = desc.weight;
  italic = desc.italic;
  small_caps = desc.small_caps;
  letter_spacing = desc.letter_spacing;
  word_spacing = desc.word_spacing;
}

void SerializedFontDescription::SetToPPBrowserFontDescription(
    PP_BrowserFont_Trusted_Description* desc) const {
  desc->face = StringVar::StringToPPVar(face);
  desc->family = static_cast<PP_BrowserFont_Trusted_Family>(family);
  desc->size = size;
  desc->weight = static_cast<PP_BrowserFont_Trusted_Weight>(weight);
  desc->italic = italic;
  desc->small_caps = small_caps;
  desc->letter_spacing = letter_spacing;
  desc->word_spacing = word_spacing;
}

SerializedNetworkInfo::SerializedNetworkInfo()
    : type(PP_NETWORKLIST_TYPE_UNKNOWN),
      state(PP_NETWORKLIST_STATE_DOWN),
      mtu(0) {
}

SerializedNetworkInfo::~SerializedNetworkInfo() {}

SerializedTrueTypeFontDesc::SerializedTrueTypeFontDesc()
    : family(),
      generic_family(),
      style(),
      weight(),
      width(),
      charset() {
}

SerializedTrueTypeFontDesc::~SerializedTrueTypeFontDesc() {}

void SerializedTrueTypeFontDesc::SetFromPPTrueTypeFontDesc(
    const PP_TrueTypeFontDesc_Dev& desc) {
  StringVar* string_var = StringVar::FromPPVar(desc.family);
  family = string_var ? string_var->value() : std::string();

  generic_family = desc.generic_family;
  style = desc.style;
  weight = desc.weight;
  width = desc.width;
  charset = desc.charset;
}

void SerializedTrueTypeFontDesc::CopyToPPTrueTypeFontDesc(
    PP_TrueTypeFontDesc_Dev* desc) const {
  desc->family = StringVar::StringToPPVar(family);

  desc->generic_family = generic_family;
  desc->style = style;
  desc->weight = weight;
  desc->width = width;
  desc->charset = charset;
}

PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params()
    : instance(0),
      font_desc(),
      color(0) {
  clip.point.x = 0;
  clip.point.y = 0;
  clip.size.height = 0;
  clip.size.width = 0;
  position.x = 0;
  position.y = 0;
  allow_subpixel_aa = PP_FALSE;
}

PPBFlash_DrawGlyphs_Params::~PPBFlash_DrawGlyphs_Params() {}

}  // namespace proxy
}  // namespace ppapi