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

Side by Side Diff: ppapi/proxy/truetype_font_resource.cc

Issue 13913006: Add Pepper TrueType font API call to enumerate fonts in a given family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
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_resource.h" 5 #include "ppapi/proxy/truetype_font_resource.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "ipc/ipc_message.h" 8 #include "ipc/ipc_message.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
(...skipping 26 matching lines...) Expand all
37 TrueTypeFontResource::~TrueTypeFontResource() { 37 TrueTypeFontResource::~TrueTypeFontResource() {
38 } 38 }
39 39
40 PPB_TrueTypeFont_API* TrueTypeFontResource::AsPPB_TrueTypeFont_API() { 40 PPB_TrueTypeFont_API* TrueTypeFontResource::AsPPB_TrueTypeFont_API() {
41 return this; 41 return this;
42 } 42 }
43 43
44 int32_t TrueTypeFontResource::Describe( 44 int32_t TrueTypeFontResource::Describe(
45 PP_TrueTypeFontDesc_Dev* desc, 45 PP_TrueTypeFontDesc_Dev* desc,
46 scoped_refptr<TrackedCallback> callback) { 46 scoped_refptr<TrackedCallback> callback) {
47
48 Call<PpapiPluginMsg_TrueTypeFont_DescribeReply>(RENDERER, 47 Call<PpapiPluginMsg_TrueTypeFont_DescribeReply>(RENDERER,
49 PpapiHostMsg_TrueTypeFont_Describe(), 48 PpapiHostMsg_TrueTypeFont_Describe(),
50 base::Bind(&TrueTypeFontResource::OnPluginMsgDescribeComplete, this, 49 base::Bind(&TrueTypeFontResource::OnPluginMsgDescribeComplete, this,
51 callback, desc)); 50 callback, desc));
52 return PP_OK_COMPLETIONPENDING; 51 return PP_OK_COMPLETIONPENDING;
53 } 52 }
54 53
55 int32_t TrueTypeFontResource::GetTableTags( 54 int32_t TrueTypeFontResource::GetTableTags(
56 const PP_ArrayOutput& output, 55 const PP_ArrayOutput& output,
57 scoped_refptr<TrackedCallback> callback) { 56 scoped_refptr<TrackedCallback> callback) {
(...skipping 18 matching lines...) Expand all
76 } 75 }
77 76
78 void TrueTypeFontResource::OnPluginMsgDescribeComplete( 77 void TrueTypeFontResource::OnPluginMsgDescribeComplete(
79 scoped_refptr<TrackedCallback> callback, 78 scoped_refptr<TrackedCallback> callback,
80 PP_TrueTypeFontDesc_Dev* pp_desc, 79 PP_TrueTypeFontDesc_Dev* pp_desc,
81 const ResourceMessageReplyParams& params, 80 const ResourceMessageReplyParams& params,
82 const ppapi::proxy::SerializedTrueTypeFontDesc& desc) { 81 const ppapi::proxy::SerializedTrueTypeFontDesc& desc) {
83 int32_t result = params.result(); 82 int32_t result = params.result();
84 if (result == PP_OK) 83 if (result == PP_OK)
85 desc.CopyToPPTrueTypeFontDesc(pp_desc); 84 desc.CopyToPPTrueTypeFontDesc(pp_desc);
85
86 callback->Run(result); 86 callback->Run(result);
87 } 87 }
88 88
89 void TrueTypeFontResource::OnPluginMsgGetTableTagsComplete( 89 void TrueTypeFontResource::OnPluginMsgGetTableTagsComplete(
90 scoped_refptr<TrackedCallback> callback, 90 scoped_refptr<TrackedCallback> callback,
91 PP_ArrayOutput array_output, 91 PP_ArrayOutput array_output,
92 const ResourceMessageReplyParams& params, 92 const ResourceMessageReplyParams& params,
93 const std::vector<uint32_t>& tag_array) { 93 const std::vector<uint32_t>& tag_array) {
94 // The result code should contain the data size if it's positive. 94 // The result code should contain the data size if it's positive.
95 int32_t result = params.result(); 95 int32_t result = params.result();
(...skipping 25 matching lines...) Expand all
121 if (output.is_valid()) 121 if (output.is_valid())
122 output.StoreArray(data.data(), std::max(0, result)); 122 output.StoreArray(data.data(), std::max(0, result));
123 else 123 else
124 result = PP_ERROR_FAILED; 124 result = PP_ERROR_FAILED;
125 125
126 callback->Run(result); 126 callback->Run(result);
127 } 127 }
128 128
129 } // namespace proxy 129 } // namespace proxy
130 } // namespace ppapi 130 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698