OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_font_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_font_dev.h" | 7 #include "ppapi/c/dev/ppb_font_dev.h" |
8 #include "ppapi/shared_impl/font_impl.h" | 8 #include "ppapi/shared_impl/font_impl.h" |
9 #include "ppapi/shared_impl/ppapi_preferences.h" | 9 #include "ppapi/shared_impl/ppapi_preferences.h" |
10 #include "ppapi/shared_impl/var.h" | 10 #include "ppapi/shared_impl/var.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace webkit { | 24 namespace webkit { |
25 namespace ppapi { | 25 namespace ppapi { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Converts the given PP_TextRun to a TextRun, returning true on success. | 29 // Converts the given PP_TextRun to a TextRun, returning true on success. |
30 // False means the input was invalid. | 30 // False means the input was invalid. |
31 bool PPTextRunToTextRun(const PP_TextRun_Dev* run, | 31 bool PPTextRunToTextRun(const PP_TextRun_Dev* run, |
32 WebKitForwarding::Font::TextRun* output) { | 32 WebKitForwarding::Font::TextRun* output) { |
33 scoped_refptr<StringVar> text_string(StringVar::FromPPVar(run->text)); | 33 StringVar* text_string = StringVar::FromPPVar(run->text); |
34 if (!text_string) | 34 if (!text_string) |
35 return false; | 35 return false; |
36 | 36 |
37 output->text = text_string->value(); | 37 output->text = text_string->value(); |
38 output->rtl = PPBoolToBool(run->rtl); | 38 output->rtl = PPBoolToBool(run->rtl); |
39 output->override_direction = PPBoolToBool(run->override_direction); | 39 output->override_direction = PPBoolToBool(run->override_direction); |
40 return true; | 40 return true; |
41 } | 41 } |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 PPB_Font_Impl::PPB_Font_Impl(PluginInstance* instance, | 45 PPB_Font_Impl::PPB_Font_Impl(PluginInstance* instance, |
46 const PP_FontDescription_Dev& desc) | 46 const PP_FontDescription_Dev& desc) |
47 : Resource(instance) { | 47 : Resource(instance) { |
48 scoped_refptr<StringVar> face_name(StringVar::FromPPVar(desc.face)); | 48 StringVar* face_name = StringVar::FromPPVar(desc.face); |
49 | 49 |
50 WebKitForwarding::Font* result = NULL; | 50 WebKitForwarding::Font* result = NULL; |
51 instance->module()->GetWebKitForwarding()->CreateFontForwarding( | 51 instance->module()->GetWebKitForwarding()->CreateFontForwarding( |
52 NULL, desc, face_name ? face_name->value() : std::string(), | 52 NULL, desc, face_name ? face_name->value() : std::string(), |
53 instance->delegate()->GetPreferences(), &result); | 53 instance->delegate()->GetPreferences(), &result); |
54 font_forwarding_.reset(result); | 54 font_forwarding_.reset(result); |
55 } | 55 } |
56 | 56 |
57 PPB_Font_Impl::~PPB_Font_Impl() { | 57 PPB_Font_Impl::~PPB_Font_Impl() { |
58 } | 58 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return this; | 151 return this; |
152 } | 152 } |
153 | 153 |
154 PP_Var PPB_Font_FunctionImpl::GetFontFamilies(PP_Instance instance) { | 154 PP_Var PPB_Font_FunctionImpl::GetFontFamilies(PP_Instance instance) { |
155 return PP_MakeUndefined(); | 155 return PP_MakeUndefined(); |
156 } | 156 } |
157 | 157 |
158 } // namespace ppapi | 158 } // namespace ppapi |
159 } // namespace webkit | 159 } // namespace webkit |
160 | 160 |
OLD | NEW |