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

Side by Side Diff: ppapi/thunk/ppb_pdf_thunk.cc

Issue 238923007: PPAPI: Format ppapi/thunk using clang-format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Popen instead, force carriage returns in thunks Created 6 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "ppapi/c/pp_errors.h" 6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/private/ppb_pdf.h" 7 #include "ppapi/c/private/ppb_pdf.h"
8 #include "ppapi/thunk/enter.h" 8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_flash_font_file_api.h" 9 #include "ppapi/thunk/ppb_flash_font_file_api.h"
10 #include "ppapi/thunk/ppb_pdf_api.h" 10 #include "ppapi/thunk/ppb_pdf_api.h"
11 #include "ppapi/thunk/resource_creation_api.h" 11 #include "ppapi/thunk/resource_creation_api.h"
12 #include "ppapi/thunk/thunk.h" 12 #include "ppapi/thunk/thunk.h"
13 13
14 namespace ppapi { 14 namespace ppapi {
15 namespace thunk { 15 namespace thunk {
16 16
17 namespace { 17 namespace {
18 18
19 PP_Var GetLocalizedString(PP_Instance instance, PP_ResourceString string_id) { 19 PP_Var GetLocalizedString(PP_Instance instance, PP_ResourceString string_id) {
20 EnterInstanceAPI<PPB_PDF_API> enter(instance); 20 EnterInstanceAPI<PPB_PDF_API> enter(instance);
21 if (enter.failed()) 21 if (enter.failed())
22 return PP_MakeUndefined(); 22 return PP_MakeUndefined();
23 return enter.functions()->GetLocalizedString(string_id); 23 return enter.functions()->GetLocalizedString(string_id);
24 } 24 }
25 25
26 PP_Resource GetResourceImage(PP_Instance instance, 26 PP_Resource GetResourceImage(PP_Instance instance, PP_ResourceImage image_id) {
27 PP_ResourceImage image_id) {
28 EnterInstanceAPI<PPB_PDF_API> enter(instance); 27 EnterInstanceAPI<PPB_PDF_API> enter(instance);
29 if (enter.failed()) 28 if (enter.failed())
30 return 0; 29 return 0;
31 return enter.functions()->GetResourceImage(image_id); 30 return enter.functions()->GetResourceImage(image_id);
32 } 31 }
33 32
34 PP_Resource GetFontFileWithFallback( 33 PP_Resource GetFontFileWithFallback(
35 PP_Instance instance, 34 PP_Instance instance,
36 const PP_BrowserFont_Trusted_Description* description, 35 const PP_BrowserFont_Trusted_Description* description,
37 PP_PrivateFontCharset charset) { 36 PP_PrivateFontCharset charset) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 125
127 PP_Resource GetResourceImageForScale(PP_Instance instance, 126 PP_Resource GetResourceImageForScale(PP_Instance instance,
128 PP_ResourceImage image_id, 127 PP_ResourceImage image_id,
129 float scale) { 128 float scale) {
130 EnterInstanceAPI<PPB_PDF_API> enter(instance); 129 EnterInstanceAPI<PPB_PDF_API> enter(instance);
131 if (enter.failed()) 130 if (enter.failed())
132 return 0; 131 return 0;
133 return enter.functions()->GetResourceImageForScale(image_id, scale); 132 return enter.functions()->GetResourceImageForScale(image_id, scale);
134 } 133 }
135 134
136 PP_Var ModalPromptForPassword(PP_Instance instance_id, 135 PP_Var ModalPromptForPassword(PP_Instance instance_id, PP_Var message) {
137 PP_Var message) {
138 // TODO(raymes): Implement or remove this function. 136 // TODO(raymes): Implement or remove this function.
139 NOTIMPLEMENTED(); 137 NOTIMPLEMENTED();
140 return PP_MakeUndefined(); 138 return PP_MakeUndefined();
141 } 139 }
142 140
143 PP_Bool IsOutOfProcess(PP_Instance instance) { 141 PP_Bool IsOutOfProcess(PP_Instance instance) {
144 EnterInstanceAPI<PPB_PDF_API> enter(instance); 142 EnterInstanceAPI<PPB_PDF_API> enter(instance);
145 if (enter.failed()) 143 if (enter.failed())
146 return PP_FALSE; 144 return PP_FALSE;
147 return enter.functions()->IsOutOfProcess(); 145 return enter.functions()->IsOutOfProcess();
148 } 146 }
149 147
150 void SetSelectedText(PP_Instance instance, 148 void SetSelectedText(PP_Instance instance, const char* selected_text) {
151 const char* selected_text) {
152 EnterInstanceAPI<PPB_PDF_API> enter(instance); 149 EnterInstanceAPI<PPB_PDF_API> enter(instance);
153 if (enter.succeeded()) 150 if (enter.succeeded())
154 enter.functions()->SetSelectedText(selected_text); 151 enter.functions()->SetSelectedText(selected_text);
155 } 152 }
156 153
157 void SetLinkUnderCursor(PP_Instance instance, const char* url) { 154 void SetLinkUnderCursor(PP_Instance instance, const char* url) {
158 EnterInstanceAPI<PPB_PDF_API> enter(instance); 155 EnterInstanceAPI<PPB_PDF_API> enter(instance);
159 if (enter.failed()) 156 if (enter.failed())
160 return; 157 return;
161 enter.functions()->SetLinkUnderCursor(url); 158 enter.functions()->SetLinkUnderCursor(url);
162 } 159 }
163 160
164 const PPB_PDF g_ppb_pdf_thunk = { 161 const PPB_PDF g_ppb_pdf_thunk = {
165 &GetLocalizedString, 162 &GetLocalizedString, &GetResourceImage,
166 &GetResourceImage, 163 &GetFontFileWithFallback, &GetFontTableForPrivateFontFile,
167 &GetFontFileWithFallback, 164 &SearchString, &DidStartLoading,
168 &GetFontTableForPrivateFontFile, 165 &DidStopLoading, &SetContentRestriction,
169 &SearchString, 166 &HistogramPDFPageCount, &UserMetricsRecordAction,
170 &DidStartLoading, 167 &HasUnsupportedFeature, &SaveAs,
171 &DidStopLoading, 168 &Print, &IsFeatureEnabled,
172 &SetContentRestriction, 169 &GetResourceImageForScale, &ModalPromptForPassword,
173 &HistogramPDFPageCount, 170 &IsOutOfProcess, &SetSelectedText,
174 &UserMetricsRecordAction, 171 &SetLinkUnderCursor, };
175 &HasUnsupportedFeature,
176 &SaveAs,
177 &Print,
178 &IsFeatureEnabled,
179 &GetResourceImageForScale,
180 &ModalPromptForPassword,
181 &IsOutOfProcess,
182 &SetSelectedText,
183 &SetLinkUnderCursor,
184 };
185 172
186 } // namespace 173 } // namespace
187 174
188 const PPB_PDF* GetPPB_PDF_Thunk() { 175 const PPB_PDF* GetPPB_PDF_Thunk() { return &g_ppb_pdf_thunk; }
189 return &g_ppb_pdf_thunk;
190 }
191 176
192 } // namespace thunk 177 } // namespace thunk
193 } // namespace ppapi 178 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698