OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ppapi/proxy/truetype_font_singleton_resource.h" | 5 #include "ppapi/proxy/truetype_font_singleton_resource.h" |
6 | 6 |
7 #include "ppapi/proxy/ppapi_messages.h" | 7 #include "ppapi/proxy/ppapi_messages.h" |
8 #include "ppapi/proxy/serialized_structs.h" | 8 #include "ppapi/proxy/serialized_structs.h" |
9 #include "ppapi/shared_impl/array_writer.h" | 9 #include "ppapi/shared_impl/array_writer.h" |
10 #include "ppapi/shared_impl/ppapi_globals.h" | 10 #include "ppapi/shared_impl/ppapi_globals.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return PP_OK_COMPLETIONPENDING; | 42 return PP_OK_COMPLETIONPENDING; |
43 } | 43 } |
44 | 44 |
45 int32_t TrueTypeFontSingletonResource::GetFontsInFamily( | 45 int32_t TrueTypeFontSingletonResource::GetFontsInFamily( |
46 PP_Instance instance, | 46 PP_Instance instance, |
47 PP_Var family, | 47 PP_Var family, |
48 const PP_ArrayOutput& output, | 48 const PP_ArrayOutput& output, |
49 const scoped_refptr<TrackedCallback>& callback) { | 49 const scoped_refptr<TrackedCallback>& callback) { |
50 scoped_refptr<StringVar> family_var = StringVar::FromPPVar(family); | 50 scoped_refptr<StringVar> family_var = StringVar::FromPPVar(family); |
51 const uint32_t kMaxFamilySizeInBytes = 1024; | 51 const uint32_t kMaxFamilySizeInBytes = 1024; |
52 if (!family_var || family_var->value().size() > kMaxFamilySizeInBytes) | 52 if (!family_var.get() || family_var->value().size() > kMaxFamilySizeInBytes) |
53 return PP_ERROR_BADARGUMENT; | 53 return PP_ERROR_BADARGUMENT; |
54 Call<PpapiPluginMsg_TrueTypeFontSingleton_GetFontsInFamilyReply>(BROWSER, | 54 Call<PpapiPluginMsg_TrueTypeFontSingleton_GetFontsInFamilyReply>(BROWSER, |
55 PpapiHostMsg_TrueTypeFontSingleton_GetFontsInFamily(family_var->value()), | 55 PpapiHostMsg_TrueTypeFontSingleton_GetFontsInFamily(family_var->value()), |
56 base::Bind( | 56 base::Bind( |
57 &TrueTypeFontSingletonResource::OnPluginMsgGetFontsInFamilyComplete, | 57 &TrueTypeFontSingletonResource::OnPluginMsgGetFontsInFamilyComplete, |
58 this, callback, output)); | 58 this, callback, output)); |
59 return PP_OK_COMPLETIONPENDING; | 59 return PP_OK_COMPLETIONPENDING; |
60 } | 60 } |
61 | 61 |
62 void TrueTypeFontSingletonResource::OnPluginMsgGetFontFamiliesComplete( | 62 void TrueTypeFontSingletonResource::OnPluginMsgGetFontFamiliesComplete( |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 } else { | 113 } else { |
114 result = PP_ERROR_FAILED; | 114 result = PP_ERROR_FAILED; |
115 } | 115 } |
116 | 116 |
117 callback->Run(result); | 117 callback->Run(result); |
118 } | 118 } |
119 | 119 |
120 } // namespace proxy | 120 } // namespace proxy |
121 } // namespace ppapi | 121 } // namespace ppapi |
OLD | NEW |