| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #ifdef _MSC_VER | 7 #ifdef _MSC_VER |
| 8 // Do not warn about use of std::copy with raw pointers. | 8 // Do not warn about use of std::copy with raw pointers. |
| 9 #pragma warning(disable : 4996) | 9 #pragma warning(disable : 4996) |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "native_client/src/trusted/plugin/ppapi/plugin_ppapi.h" | 12 #include "native_client/src/trusted/plugin/ppapi/plugin_ppapi.h" |
| 13 | 13 |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <algorithm> | 15 #include <algorithm> |
| 16 #include <deque> | 16 #include <deque> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "native_client/src/include/nacl_base.h" | 19 #include "native_client/src/include/nacl_base.h" |
| 20 #include "native_client/src/include/nacl_macros.h" | 20 #include "native_client/src/include/nacl_macros.h" |
| 21 #include "native_client/src/include/nacl_scoped_ptr.h" | 21 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 22 #include "native_client/src/include/nacl_string.h" | 22 #include "native_client/src/include/nacl_string.h" |
| 23 #include "native_client/src/include/portability.h" | 23 #include "native_client/src/include/portability.h" |
| 24 #include "native_client/src/include/portability_io.h" | 24 #include "native_client/src/include/portability_io.h" |
| 25 #include "native_client/src/shared/platform/nacl_check.h" | 25 #include "native_client/src/shared/platform/nacl_check.h" |
| 26 #include "native_client/src/shared/platform/nacl_time.h" | 26 #include "native_client/src/shared/platform/nacl_time.h" |
| 27 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" | 27 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" |
| 28 #include "native_client/src/third_party/ppapi/c/ppp_input_event.h" |
| 29 #include "native_client/src/third_party/ppapi/cpp/input_event.h" |
| 28 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 30 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
| 29 #include "native_client/src/trusted/handle_pass/browser_handle.h" | 31 #include "native_client/src/trusted/handle_pass/browser_handle.h" |
| 30 #include "native_client/src/trusted/plugin/desc_based_handle.h" | 32 #include "native_client/src/trusted/plugin/desc_based_handle.h" |
| 31 #include "native_client/src/trusted/plugin/plugin_error.h" | 33 #include "native_client/src/trusted/plugin/plugin_error.h" |
| 32 #include "native_client/src/trusted/plugin/nexe_arch.h" | 34 #include "native_client/src/trusted/plugin/nexe_arch.h" |
| 33 #include "native_client/src/trusted/plugin/ppapi/async_receive.h" | 35 #include "native_client/src/trusted/plugin/ppapi/async_receive.h" |
| 34 #include "native_client/src/trusted/plugin/ppapi/browser_interface_ppapi.h" | 36 #include "native_client/src/trusted/plugin/ppapi/browser_interface_ppapi.h" |
| 35 #include "native_client/src/trusted/plugin/ppapi/manifest.h" | 37 #include "native_client/src/trusted/plugin/ppapi/manifest.h" |
| 36 #include "native_client/src/trusted/plugin/ppapi/scriptable_handle_ppapi.h" | 38 #include "native_client/src/trusted/plugin/ppapi/scriptable_handle_ppapi.h" |
| 37 #include "native_client/src/trusted/plugin/scriptable_handle.h" | 39 #include "native_client/src/trusted/plugin/scriptable_handle.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 PLUGIN_PRINTF(("PluginPpapi::DidChangeFocus (this=%p)\n", | 693 PLUGIN_PRINTF(("PluginPpapi::DidChangeFocus (this=%p)\n", |
| 692 static_cast<void*>(this))); | 694 static_cast<void*>(this))); |
| 693 if (ppapi_proxy_ == NULL) { | 695 if (ppapi_proxy_ == NULL) { |
| 694 return; | 696 return; |
| 695 } else { | 697 } else { |
| 696 ppapi_proxy_->ppp_instance_interface()->DidChangeFocus( | 698 ppapi_proxy_->ppp_instance_interface()->DidChangeFocus( |
| 697 pp_instance(), PP_FromBool(has_focus)); | 699 pp_instance(), PP_FromBool(has_focus)); |
| 698 } | 700 } |
| 699 } | 701 } |
| 700 | 702 |
| 701 | |
| 702 bool PluginPpapi::HandleInputEvent(const PP_InputEvent& event) { | 703 bool PluginPpapi::HandleInputEvent(const PP_InputEvent& event) { |
| 703 PLUGIN_PRINTF(("PluginPpapi::HandleInputEvent (this=%p)\n", | 704 PLUGIN_PRINTF(("PluginPpapi::HandleInputEvent (this=%p)\n", |
| 704 static_cast<void*>(this))); | 705 static_cast<void*>(this))); |
| 705 if (ppapi_proxy_ == NULL) { | 706 if (ppapi_proxy_ == NULL) { |
| 706 return false; // event is not handled here. | 707 return false; // event is not handled here. |
| 707 } else { | 708 } else { |
| 708 bool handled = pp::PPBoolToBool( | 709 bool handled = pp::PPBoolToBool( |
| 709 ppapi_proxy_->ppp_instance_interface()->HandleInputEvent( | 710 ppapi_proxy_->ppp_instance_interface()->HandleInputEvent( |
| 710 pp_instance(), &event)); | 711 pp_instance(), &event)); |
| 712 PLUGIN_PRINTF(("PluginPpapi::HandleInputEvent (old) (handled=%d)\n", |
| 713 handled)); |
| 714 return handled; |
| 715 } |
| 716 } |
| 717 |
| 718 bool PluginPpapi::HandleInputEvent(const pp::InputEvent& event) { |
| 719 PLUGIN_PRINTF(("PluginPpapi::HandleInputEvent (this=%p)\n", |
| 720 static_cast<void*>(this))); |
| 721 if ((ppapi_proxy_ == NULL) || !(ppapi_proxy_->ppp_input_event_interface())) { |
| 722 return false; // event is not handled here. |
| 723 } else { |
| 724 bool handled = pp::PPBoolToBool( |
| 725 ppapi_proxy_->ppp_input_event_interface()->HandleInputEvent( |
| 726 pp_instance(), event.pp_resource())); |
| 711 PLUGIN_PRINTF(("PluginPpapi::HandleInputEvent (handled=%d)\n", handled)); | 727 PLUGIN_PRINTF(("PluginPpapi::HandleInputEvent (handled=%d)\n", handled)); |
| 712 return handled; | 728 return handled; |
| 713 } | 729 } |
| 714 } | 730 } |
| 715 | 731 |
| 716 | |
| 717 bool PluginPpapi::HandleDocumentLoad(const pp::URLLoader& url_loader) { | 732 bool PluginPpapi::HandleDocumentLoad(const pp::URLLoader& url_loader) { |
| 718 PLUGIN_PRINTF(("PluginPpapi::HandleDocumentLoad (this=%p)\n", | 733 PLUGIN_PRINTF(("PluginPpapi::HandleDocumentLoad (this=%p)\n", |
| 719 static_cast<void*>(this))); | 734 static_cast<void*>(this))); |
| 720 if (ppapi_proxy_ == NULL) { | 735 if (ppapi_proxy_ == NULL) { |
| 721 // Store this event and replay it when the proxy becomes available. | 736 // Store this event and replay it when the proxy becomes available. |
| 722 replayHandleDocumentLoad = true; | 737 replayHandleDocumentLoad = true; |
| 723 replayHandleDocumentLoadURLLoader = url_loader; | 738 replayHandleDocumentLoadURLLoader = url_loader; |
| 724 // Return true so that the browser keeps servicing this loader so we can | 739 // Return true so that the browser keeps servicing this loader so we can |
| 725 // perform requests on it later. | 740 // perform requests on it later. |
| 726 return true; | 741 return true; |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, | 1554 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, |
| 1540 comps.scheme.len); | 1555 comps.scheme.len); |
| 1541 if (scheme == kChromeExtensionUriScheme) | 1556 if (scheme == kChromeExtensionUriScheme) |
| 1542 return SCHEME_CHROME_EXTENSION; | 1557 return SCHEME_CHROME_EXTENSION; |
| 1543 if (scheme == kDataUriScheme) | 1558 if (scheme == kDataUriScheme) |
| 1544 return SCHEME_DATA; | 1559 return SCHEME_DATA; |
| 1545 return SCHEME_OTHER; | 1560 return SCHEME_OTHER; |
| 1546 } | 1561 } |
| 1547 | 1562 |
| 1548 } // namespace plugin | 1563 } // namespace plugin |
| OLD | NEW |