| 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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
| 6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
| 7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include "native_client/src/trusted/plugin/plugin.h" | 10 #include "native_client/src/trusted/plugin/plugin.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "native_client/src/trusted/plugin/nexe_arch.h" | 39 #include "native_client/src/trusted/plugin/nexe_arch.h" |
| 40 #include "native_client/src/trusted/plugin/plugin_error.h" | 40 #include "native_client/src/trusted/plugin/plugin_error.h" |
| 41 #include "native_client/src/trusted/plugin/scriptable_plugin.h" | 41 #include "native_client/src/trusted/plugin/scriptable_plugin.h" |
| 42 #include "native_client/src/trusted/plugin/service_runtime.h" | 42 #include "native_client/src/trusted/plugin/service_runtime.h" |
| 43 #include "native_client/src/trusted/plugin/utility.h" | 43 #include "native_client/src/trusted/plugin/utility.h" |
| 44 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" | 44 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
| 45 | 45 |
| 46 #include "ppapi/c/dev/ppb_console_dev.h" | 46 #include "ppapi/c/dev/ppb_console_dev.h" |
| 47 #include "ppapi/c/dev/ppp_find_dev.h" | 47 #include "ppapi/c/dev/ppp_find_dev.h" |
| 48 #include "ppapi/c/dev/ppp_printing_dev.h" | 48 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 49 #include "ppapi/c/dev/ppp_scrollbar_dev.h" | |
| 50 #include "ppapi/c/dev/ppp_selection_dev.h" | 49 #include "ppapi/c/dev/ppp_selection_dev.h" |
| 51 #include "ppapi/c/dev/ppp_widget_dev.h" | |
| 52 #include "ppapi/c/dev/ppp_zoom_dev.h" | 50 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 53 #include "ppapi/c/pp_errors.h" | 51 #include "ppapi/c/pp_errors.h" |
| 54 #include "ppapi/c/ppb_var.h" | 52 #include "ppapi/c/ppb_var.h" |
| 55 #include "ppapi/c/ppp_input_event.h" | 53 #include "ppapi/c/ppp_input_event.h" |
| 56 #include "ppapi/c/ppp_instance.h" | 54 #include "ppapi/c/ppp_instance.h" |
| 57 #include "ppapi/c/ppp_mouse_lock.h" | 55 #include "ppapi/c/ppp_mouse_lock.h" |
| 58 #include "ppapi/c/private/ppb_nacl_private.h" | 56 #include "ppapi/c/private/ppb_nacl_private.h" |
| 59 #include "ppapi/c/private/ppb_uma_private.h" | 57 #include "ppapi/c/private/ppb_uma_private.h" |
| 60 #include "ppapi/cpp/dev/find_dev.h" | 58 #include "ppapi/cpp/dev/find_dev.h" |
| 61 #include "ppapi/cpp/dev/printing_dev.h" | 59 #include "ppapi/cpp/dev/printing_dev.h" |
| 62 #include "ppapi/cpp/dev/scrollbar_dev.h" | |
| 63 #include "ppapi/cpp/dev/selection_dev.h" | 60 #include "ppapi/cpp/dev/selection_dev.h" |
| 64 #include "ppapi/cpp/dev/text_input_dev.h" | 61 #include "ppapi/cpp/dev/text_input_dev.h" |
| 65 #include "ppapi/cpp/dev/url_util_dev.h" | 62 #include "ppapi/cpp/dev/url_util_dev.h" |
| 66 #include "ppapi/cpp/dev/widget_client_dev.h" | |
| 67 #include "ppapi/cpp/dev/zoom_dev.h" | 63 #include "ppapi/cpp/dev/zoom_dev.h" |
| 68 #include "ppapi/cpp/image_data.h" | 64 #include "ppapi/cpp/image_data.h" |
| 69 #include "ppapi/cpp/input_event.h" | 65 #include "ppapi/cpp/input_event.h" |
| 70 #include "ppapi/cpp/module.h" | 66 #include "ppapi/cpp/module.h" |
| 71 #include "ppapi/cpp/mouse_lock.h" | 67 #include "ppapi/cpp/mouse_lock.h" |
| 72 #include "ppapi/cpp/rect.h" | 68 #include "ppapi/cpp/rect.h" |
| 73 | 69 |
| 74 using ppapi_proxy::BrowserPpp; | 70 using ppapi_proxy::BrowserPpp; |
| 75 | 71 |
| 76 namespace plugin { | 72 namespace plugin { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 392 } |
| 397 | 393 |
| 398 private: | 394 private: |
| 399 Plugin* plugin_; | 395 Plugin* plugin_; |
| 400 const PPP_Selection_Dev* ppp_selection_; | 396 const PPP_Selection_Dev* ppp_selection_; |
| 401 | 397 |
| 402 NACL_DISALLOW_COPY_AND_ASSIGN(SelectionAdapter); | 398 NACL_DISALLOW_COPY_AND_ASSIGN(SelectionAdapter); |
| 403 }; | 399 }; |
| 404 | 400 |
| 405 | 401 |
| 406 // Derive a class from pp::WidgetClient_Dev to forward PPP_Widget_Dev | |
| 407 // and PPP_Scrollbar_Dev calls to the plugin. | |
| 408 class WidgetClientAdapter : public pp::WidgetClient_Dev { | |
| 409 public: | |
| 410 explicit WidgetClientAdapter(Plugin* plugin) | |
| 411 : pp::WidgetClient_Dev(plugin), | |
| 412 plugin_(plugin) { | |
| 413 BrowserPpp* proxy = plugin_->ppapi_proxy(); | |
| 414 CHECK(proxy != NULL); | |
| 415 ppp_widget_ = static_cast<const PPP_Widget_Dev*>( | |
| 416 proxy->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE)); | |
| 417 ppp_scrollbar_ = static_cast<const PPP_Scrollbar_Dev*>( | |
| 418 proxy->GetPluginInterface(PPP_SCROLLBAR_DEV_INTERFACE)); | |
| 419 } | |
| 420 | |
| 421 void InvalidateWidget(pp::Widget_Dev widget, const pp::Rect& dirty_rect) { | |
| 422 if (ppp_widget_ != NULL) { | |
| 423 ppp_widget_->Invalidate(plugin_->pp_instance(), | |
| 424 widget.pp_resource(), | |
| 425 &dirty_rect.pp_rect()); | |
| 426 } | |
| 427 } | |
| 428 | |
| 429 void ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar, uint32_t value) { | |
| 430 if (ppp_scrollbar_ != NULL) { | |
| 431 ppp_scrollbar_->ValueChanged(plugin_->pp_instance(), | |
| 432 scrollbar.pp_resource(), | |
| 433 value); | |
| 434 } | |
| 435 } | |
| 436 | |
| 437 void ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar, bool overlay) { | |
| 438 if (ppp_scrollbar_ != NULL) { | |
| 439 ppp_scrollbar_->OverlayChanged(plugin_->pp_instance(), | |
| 440 scrollbar.pp_resource(), | |
| 441 PP_FromBool(overlay)); | |
| 442 } | |
| 443 } | |
| 444 | |
| 445 private: | |
| 446 Plugin* plugin_; | |
| 447 const PPP_Widget_Dev* ppp_widget_; | |
| 448 const PPP_Scrollbar_Dev* ppp_scrollbar_; | |
| 449 | |
| 450 NACL_DISALLOW_COPY_AND_ASSIGN(WidgetClientAdapter); | |
| 451 }; | |
| 452 | |
| 453 | |
| 454 // Derive a class from pp::Zoom_Dev to forward PPP_Zoom_Dev calls to | 402 // Derive a class from pp::Zoom_Dev to forward PPP_Zoom_Dev calls to |
| 455 // the plugin. | 403 // the plugin. |
| 456 class ZoomAdapter : public pp::Zoom_Dev { | 404 class ZoomAdapter : public pp::Zoom_Dev { |
| 457 public: | 405 public: |
| 458 explicit ZoomAdapter(Plugin* plugin) | 406 explicit ZoomAdapter(Plugin* plugin) |
| 459 : pp::Zoom_Dev(plugin), | 407 : pp::Zoom_Dev(plugin), |
| 460 plugin_(plugin) { | 408 plugin_(plugin) { |
| 461 BrowserPpp* proxy = plugin_->ppapi_proxy(); | 409 BrowserPpp* proxy = plugin_->ppapi_proxy(); |
| 462 CHECK(proxy != NULL); | 410 CHECK(proxy != NULL); |
| 463 ppp_zoom_ = static_cast<const PPP_Zoom_Dev*>( | 411 ppp_zoom_ = static_cast<const PPP_Zoom_Dev*>( |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 return false; | 1267 return false; |
| 1320 } | 1268 } |
| 1321 | 1269 |
| 1322 ppapi_proxy_ = ppapi_proxy.release(); | 1270 ppapi_proxy_ = ppapi_proxy.release(); |
| 1323 | 1271 |
| 1324 // Create PPP* interface adapters to forward calls to .nexe. | 1272 // Create PPP* interface adapters to forward calls to .nexe. |
| 1325 find_adapter_.reset(new FindAdapter(this)); | 1273 find_adapter_.reset(new FindAdapter(this)); |
| 1326 mouse_lock_adapter_.reset(new MouseLockAdapter(this)); | 1274 mouse_lock_adapter_.reset(new MouseLockAdapter(this)); |
| 1327 printing_adapter_.reset(new PrintingAdapter(this)); | 1275 printing_adapter_.reset(new PrintingAdapter(this)); |
| 1328 selection_adapter_.reset(new SelectionAdapter(this)); | 1276 selection_adapter_.reset(new SelectionAdapter(this)); |
| 1329 widget_client_adapter_.reset(new WidgetClientAdapter(this)); | |
| 1330 zoom_adapter_.reset(new ZoomAdapter(this)); | 1277 zoom_adapter_.reset(new ZoomAdapter(this)); |
| 1331 | 1278 |
| 1332 // Replay missed events. | 1279 // Replay missed events. |
| 1333 if (!view_to_replay_.is_null()) { | 1280 if (!view_to_replay_.is_null()) { |
| 1334 DidChangeView(view_to_replay_); | 1281 DidChangeView(view_to_replay_); |
| 1335 view_to_replay_ = pp::View(); | 1282 view_to_replay_ = pp::View(); |
| 1336 } | 1283 } |
| 1337 if (!document_load_to_replay_.is_null()) { | 1284 if (!document_load_to_replay_.is_null()) { |
| 1338 HandleDocumentLoad(document_load_to_replay_); | 1285 HandleDocumentLoad(document_load_to_replay_); |
| 1339 document_load_to_replay_ = pp::URLLoader(); | 1286 document_load_to_replay_ = pp::URLLoader(); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 static_cast<uint32_t>(text.size())); | 1898 static_cast<uint32_t>(text.size())); |
| 1952 const PPB_Console_Dev* console_interface = | 1899 const PPB_Console_Dev* console_interface = |
| 1953 static_cast<const PPB_Console_Dev*>( | 1900 static_cast<const PPB_Console_Dev*>( |
| 1954 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 1901 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
| 1955 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1902 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
| 1956 var_interface->Release(prefix); | 1903 var_interface->Release(prefix); |
| 1957 var_interface->Release(str); | 1904 var_interface->Release(str); |
| 1958 } | 1905 } |
| 1959 | 1906 |
| 1960 } // namespace plugin | 1907 } // namespace plugin |
| OLD | NEW |