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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_impl.cc

Issue 11415140: Refactor 3 PPB_Flash functions to the new resource model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 sk_positions[i].set(x, y); 150 sk_positions[i].set(x, y);
151 x += SkFloatToScalar(glyph_advances[i].x); 151 x += SkFloatToScalar(glyph_advances[i].x);
152 y += SkFloatToScalar(glyph_advances[i].y); 152 y += SkFloatToScalar(glyph_advances[i].y);
153 } 153 }
154 154
155 canvas->drawPosText(glyph_indices, glyph_count * 2, sk_positions, paint); 155 canvas->drawPosText(glyph_indices, glyph_count * 2, sk_positions, paint);
156 156
157 return PP_TRUE; 157 return PP_TRUE;
158 } 158 }
159 159
160 PP_Var PPB_Flash_Impl::GetProxyForURL(PP_Instance instance,
161 const char* url) {
162 GURL gurl(url);
163 if (!gurl.is_valid())
164 return PP_MakeUndefined();
165
166 std::string proxy_host = instance_->delegate()->ResolveProxy(gurl);
167 if (proxy_host.empty())
168 return PP_MakeUndefined(); // No proxy.
169 return StringVar::StringToPPVar(proxy_host);
170 }
171
172 int32_t PPB_Flash_Impl::Navigate(PP_Instance instance, 160 int32_t PPB_Flash_Impl::Navigate(PP_Instance instance,
173 PP_Resource request_info, 161 PP_Resource request_info,
174 const char* target, 162 const char* target,
175 PP_Bool from_user_action) { 163 PP_Bool from_user_action) {
176 EnterResourceNoLock<PPB_URLRequestInfo_API> enter(request_info, true); 164 EnterResourceNoLock<PPB_URLRequestInfo_API> enter(request_info, true);
177 if (enter.failed()) 165 if (enter.failed())
178 return PP_ERROR_BADRESOURCE; 166 return PP_ERROR_BADRESOURCE;
179 return Navigate(instance, enter.object()->GetData(), target, 167 return Navigate(instance, enter.object()->GetData(), target,
180 from_user_action); 168 from_user_action);
181 } 169 }
(...skipping 22 matching lines...) Expand all
204 return instance_->delegate()->GetLocalTimeZoneOffset(PPTimeToTime(t)); 192 return instance_->delegate()->GetLocalTimeZoneOffset(PPTimeToTime(t));
205 } 193 }
206 194
207 PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance, 195 PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance,
208 const PP_Rect* rect) { 196 const PP_Rect* rect) {
209 return PP_FromBool(instance_->IsRectTopmost( 197 return PP_FromBool(instance_->IsRectTopmost(
210 gfx::Rect(rect->point.x, rect->point.y, 198 gfx::Rect(rect->point.x, rect->point.y,
211 rect->size.width, rect->size.height))); 199 rect->size.width, rect->size.height)));
212 } 200 }
213 201
214 void PPB_Flash_Impl::UpdateActivity(PP_Instance pp_instance) {
215 // Not supported in-process.
216 }
217
218 PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance, 202 PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance,
219 PP_FlashSetting setting) { 203 PP_FlashSetting setting) {
220 switch(setting) { 204 switch(setting) {
221 case PP_FLASHSETTING_LSORESTRICTIONS: { 205 case PP_FLASHSETTING_LSORESTRICTIONS: {
222 return PP_MakeInt32( 206 return PP_MakeInt32(
223 instance_->delegate()->GetLocalDataRestrictions( 207 instance_->delegate()->GetLocalDataRestrictions(
224 instance_->container()->element().document().url(), 208 instance_->container()->element().document().url(),
225 instance_->plugin_url())); 209 instance_->plugin_url()));
226 } 210 }
227 default: 211 default:
228 // No other settings are supported in-process. 212 // No other settings are supported in-process.
229 return PP_MakeUndefined(); 213 return PP_MakeUndefined();
230 } 214 }
231 } 215 }
232 216
233 PP_Bool PPB_Flash_Impl::SetCrashData(PP_Instance instance,
234 PP_FlashCrashKey key,
235 PP_Var value) {
236 // Not implemented in process.
237 return PP_FALSE;
238 }
239
240 bool PPB_Flash_Impl::CreateThreadAdapterForInstance(PP_Instance instance) { 217 bool PPB_Flash_Impl::CreateThreadAdapterForInstance(PP_Instance instance) {
241 return false; // No multithreaded access allowed. 218 return false; // No multithreaded access allowed.
242 } 219 }
243 220
244 void PPB_Flash_Impl::ClearThreadAdapterForInstance(PP_Instance instance) { 221 void PPB_Flash_Impl::ClearThreadAdapterForInstance(PP_Instance instance) {
245 } 222 }
246 223
247 int32_t PPB_Flash_Impl::OpenFile(PP_Instance pp_instance, 224 int32_t PPB_Flash_Impl::OpenFile(PP_Instance pp_instance,
248 const char* path, 225 const char* path,
249 int32_t mode, 226 int32_t mode,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 if (file_info.is_directory) 429 if (file_info.is_directory)
453 info->type = PP_FILETYPE_DIRECTORY; 430 info->type = PP_FILETYPE_DIRECTORY;
454 else 431 else
455 info->type = PP_FILETYPE_REGULAR; 432 info->type = PP_FILETYPE_REGULAR;
456 } 433 }
457 return ::ppapi::PlatformFileErrorToPepperError(result); 434 return ::ppapi::PlatformFileErrorToPepperError(result);
458 } 435 }
459 436
460 } // namespace ppapi 437 } // namespace ppapi
461 } // namespace webkit 438 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698