OLD | NEW |
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/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "ppapi/c/dev/ppb_font_dev.h" | 13 #include "ppapi/c/dev/ppb_font_dev.h" |
14 #include "ppapi/c/private/ppb_flash.h" | 14 #include "ppapi/c/private/ppb_flash.h" |
15 #include "ppapi/shared_impl/time_conversion.h" | 15 #include "ppapi/shared_impl/time_conversion.h" |
16 #include "ppapi/shared_impl/var.h" | 16 #include "ppapi/shared_impl/var.h" |
17 #include "ppapi/thunk/enter.h" | 17 #include "ppapi/thunk/enter.h" |
18 #include "ppapi/thunk/ppb_image_data_api.h" | 18 #include "ppapi/thunk/ppb_image_data_api.h" |
19 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
20 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
21 #include "third_party/skia/include/core/SkMatrix.h" | 21 #include "third_party/skia/include/core/SkMatrix.h" |
22 #include "third_party/skia/include/core/SkPaint.h" | 22 #include "third_party/skia/include/core/SkPaint.h" |
23 #include "third_party/skia/include/core/SkPoint.h" | 23 #include "third_party/skia/include/core/SkPoint.h" |
24 #include "third_party/skia/include/core/SkTemplates.h" | 24 #include "third_party/skia/include/core/SkTemplates.h" |
25 #include "third_party/skia/include/core/SkTypeface.h" | 25 #include "third_party/skia/include/core/SkTypeface.h" |
| 26 #include "ui/gfx/rect.h" |
26 #include "webkit/plugins/ppapi/common.h" | 27 #include "webkit/plugins/ppapi/common.h" |
27 #include "webkit/plugins/ppapi/host_globals.h" | 28 #include "webkit/plugins/ppapi/host_globals.h" |
28 #include "webkit/plugins/ppapi/plugin_delegate.h" | 29 #include "webkit/plugins/ppapi/plugin_delegate.h" |
29 #include "webkit/plugins/ppapi/plugin_module.h" | 30 #include "webkit/plugins/ppapi/plugin_module.h" |
30 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 31 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
31 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 32 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
32 #include "webkit/plugins/ppapi/resource_helper.h" | 33 #include "webkit/plugins/ppapi/resource_helper.h" |
33 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 34 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
34 | 35 |
35 using ppapi::PPTimeToTime; | 36 using ppapi::PPTimeToTime; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return PP_MakeUndefined(); | 236 return PP_MakeUndefined(); |
236 | 237 |
237 std::string args = instance->delegate()->GetFlashCommandLineArgs(); | 238 std::string args = instance->delegate()->GetFlashCommandLineArgs(); |
238 return StringVar::StringToPPVar(args); | 239 return StringVar::StringToPPVar(args); |
239 } | 240 } |
240 | 241 |
241 void PreLoadFontWin(const void* logfontw) { | 242 void PreLoadFontWin(const void* logfontw) { |
242 // Not implemented in-process. | 243 // Not implemented in-process. |
243 } | 244 } |
244 | 245 |
| 246 PP_Bool IsRectTopmost(PP_Instance pp_instance, const PP_Rect* rect) { |
| 247 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 248 if (!instance) |
| 249 return PP_FALSE; |
| 250 return PP_FromBool(instance->IsRectTopmost( |
| 251 gfx::Rect(rect->point.x, rect->point.y, |
| 252 rect->size.width, rect->size.height))); |
| 253 } |
| 254 |
| 255 int32_t InvokePrinting(PP_Instance pp_instance) { |
| 256 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 257 if (!instance) |
| 258 return PP_ERROR_BADARGUMENT; |
| 259 |
| 260 // TODO(viettrungluu): Implement me. |
| 261 |
| 262 return PP_ERROR_NOTSUPPORTED; |
| 263 } |
| 264 |
| 265 void UpdateActivity(PP_Instance pp_instance) { |
| 266 // TODO(viettrungluu): Implement me. |
| 267 } |
| 268 |
245 const PPB_Flash_11 ppb_flash_11 = { | 269 const PPB_Flash_11 ppb_flash_11 = { |
246 &SetInstanceAlwaysOnTop, | 270 &SetInstanceAlwaysOnTop, |
247 &DrawGlyphs11, | 271 &DrawGlyphs11, |
248 &GetProxyForURL, | 272 &GetProxyForURL, |
249 &Navigate11, | 273 &Navigate11, |
250 &RunMessageLoop, | 274 &RunMessageLoop, |
251 &QuitMessageLoop, | 275 &QuitMessageLoop, |
252 &GetLocalTimeZoneOffset, | 276 &GetLocalTimeZoneOffset, |
253 &GetCommandLineArgs | 277 &GetCommandLineArgs |
254 }; | 278 }; |
255 | 279 |
256 const PPB_Flash ppb_flash_12 = { | 280 const PPB_Flash_12_0 ppb_flash_12_0 = { |
257 &SetInstanceAlwaysOnTop, | 281 &SetInstanceAlwaysOnTop, |
258 &DrawGlyphs, | 282 &DrawGlyphs, |
259 &GetProxyForURL, | 283 &GetProxyForURL, |
260 &Navigate, | 284 &Navigate, |
261 &RunMessageLoop, | 285 &RunMessageLoop, |
262 &QuitMessageLoop, | 286 &QuitMessageLoop, |
263 &GetLocalTimeZoneOffset, | 287 &GetLocalTimeZoneOffset, |
264 &GetCommandLineArgs, | 288 &GetCommandLineArgs, |
265 &PreLoadFontWin | 289 &PreLoadFontWin |
266 }; | 290 }; |
267 | 291 |
| 292 const PPB_Flash_12_1 ppb_flash_12_1 = { |
| 293 &SetInstanceAlwaysOnTop, |
| 294 &DrawGlyphs, |
| 295 &GetProxyForURL, |
| 296 &Navigate, |
| 297 &RunMessageLoop, |
| 298 &QuitMessageLoop, |
| 299 &GetLocalTimeZoneOffset, |
| 300 &GetCommandLineArgs, |
| 301 &PreLoadFontWin, |
| 302 &IsRectTopmost, |
| 303 &InvokePrinting, |
| 304 &UpdateActivity |
| 305 }; |
| 306 |
268 } // namespace | 307 } // namespace |
269 | 308 |
270 // static | 309 // static |
271 const PPB_Flash_11* PPB_Flash_Impl::GetInterface11() { | 310 const PPB_Flash_11* PPB_Flash_Impl::GetInterface11() { |
272 return &ppb_flash_11; | 311 return &ppb_flash_11; |
273 } | 312 } |
274 | 313 |
275 // static | 314 // static |
276 const PPB_Flash_12_0* PPB_Flash_Impl::GetInterface12_0() { | 315 const PPB_Flash_12_0* PPB_Flash_Impl::GetInterface12_0() { |
277 return &ppb_flash_12; | 316 return &ppb_flash_12_0; |
| 317 } |
| 318 |
| 319 // static |
| 320 const PPB_Flash_12_1* PPB_Flash_Impl::GetInterface12_1() { |
| 321 return &ppb_flash_12_1; |
278 } | 322 } |
279 | 323 |
280 } // namespace ppapi | 324 } // namespace ppapi |
281 } // namespace webkit | 325 } // namespace webkit |
OLD | NEW |