| 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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 using ppapi::TrackedCallback; | 145 using ppapi::TrackedCallback; |
| 146 using ppapi::thunk::EnterResourceNoLock; | 146 using ppapi::thunk::EnterResourceNoLock; |
| 147 using ppapi::thunk::PPB_Buffer_API; | 147 using ppapi::thunk::PPB_Buffer_API; |
| 148 using ppapi::thunk::PPB_Gamepad_API; | 148 using ppapi::thunk::PPB_Gamepad_API; |
| 149 using ppapi::thunk::PPB_Graphics2D_API; | 149 using ppapi::thunk::PPB_Graphics2D_API; |
| 150 using ppapi::thunk::PPB_Graphics3D_API; | 150 using ppapi::thunk::PPB_Graphics3D_API; |
| 151 using ppapi::thunk::PPB_ImageData_API; | 151 using ppapi::thunk::PPB_ImageData_API; |
| 152 using ppapi::Var; | 152 using ppapi::Var; |
| 153 using ppapi::ArrayBufferVar; | 153 using ppapi::ArrayBufferVar; |
| 154 using ppapi::ViewData; | 154 using ppapi::ViewData; |
| 155 using WebKit::WebBindings; | 155 using blink::WebBindings; |
| 156 using WebKit::WebCanvas; | 156 using blink::WebCanvas; |
| 157 using WebKit::WebCursorInfo; | 157 using blink::WebCursorInfo; |
| 158 using WebKit::WebDocument; | 158 using blink::WebDocument; |
| 159 using WebKit::WebElement; | 159 using blink::WebElement; |
| 160 using WebKit::WebFrame; | 160 using blink::WebFrame; |
| 161 using WebKit::WebInputEvent; | 161 using blink::WebInputEvent; |
| 162 using WebKit::WebPlugin; | 162 using blink::WebPlugin; |
| 163 using WebKit::WebPluginContainer; | 163 using blink::WebPluginContainer; |
| 164 using WebKit::WebPrintParams; | 164 using blink::WebPrintParams; |
| 165 using WebKit::WebPrintScalingOption; | 165 using blink::WebPrintScalingOption; |
| 166 using WebKit::WebScopedUserGesture; | 166 using blink::WebScopedUserGesture; |
| 167 using WebKit::WebString; | 167 using blink::WebString; |
| 168 using WebKit::WebURLError; | 168 using blink::WebURLError; |
| 169 using WebKit::WebURLLoader; | 169 using blink::WebURLLoader; |
| 170 using WebKit::WebURLLoaderClient; | 170 using blink::WebURLLoaderClient; |
| 171 using WebKit::WebURLRequest; | 171 using blink::WebURLRequest; |
| 172 using WebKit::WebURLResponse; | 172 using blink::WebURLResponse; |
| 173 using WebKit::WebUserGestureIndicator; | 173 using blink::WebUserGestureIndicator; |
| 174 using WebKit::WebUserGestureToken; | 174 using blink::WebUserGestureToken; |
| 175 using WebKit::WebView; | 175 using blink::WebView; |
| 176 | 176 |
| 177 namespace content { | 177 namespace content { |
| 178 | 178 |
| 179 #if defined(OS_WIN) | 179 #if defined(OS_WIN) |
| 180 // Exported by pdf.dll | 180 // Exported by pdf.dll |
| 181 typedef bool (*RenderPDFPageToDCProc)( | 181 typedef bool (*RenderPDFPageToDCProc)( |
| 182 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, | 182 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, |
| 183 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, | 183 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, |
| 184 int bounds_width, int bounds_height, bool fit_to_bounds, | 184 int bounds_width, int bounds_height, bool fit_to_bounds, |
| 185 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds, | 185 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_MOUSECURSOR_TYPE_COPY); | 295 COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_MOUSECURSOR_TYPE_COPY); |
| 296 COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_MOUSECURSOR_TYPE_NONE); | 296 COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_MOUSECURSOR_TYPE_NONE); |
| 297 COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_MOUSECURSOR_TYPE_NOTALLOWED); | 297 COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_MOUSECURSOR_TYPE_NOTALLOWED); |
| 298 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_MOUSECURSOR_TYPE_ZOOMIN); | 298 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_MOUSECURSOR_TYPE_ZOOMIN); |
| 299 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_MOUSECURSOR_TYPE_ZOOMOUT); | 299 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_MOUSECURSOR_TYPE_ZOOMOUT); |
| 300 COMPILE_ASSERT_MATCHING_ENUM(TypeGrab, PP_MOUSECURSOR_TYPE_GRAB); | 300 COMPILE_ASSERT_MATCHING_ENUM(TypeGrab, PP_MOUSECURSOR_TYPE_GRAB); |
| 301 COMPILE_ASSERT_MATCHING_ENUM(TypeGrabbing, PP_MOUSECURSOR_TYPE_GRABBING); | 301 COMPILE_ASSERT_MATCHING_ENUM(TypeGrabbing, PP_MOUSECURSOR_TYPE_GRABBING); |
| 302 // Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM; | 302 // Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM; |
| 303 // PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types. | 303 // PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types. |
| 304 | 304 |
| 305 COMPILE_ASSERT_PRINT_SCALING_MATCHING_ENUM(WebKit::WebPrintScalingOptionNone, | 305 COMPILE_ASSERT_PRINT_SCALING_MATCHING_ENUM(blink::WebPrintScalingOptionNone, |
| 306 PP_PRINTSCALINGOPTION_NONE); | 306 PP_PRINTSCALINGOPTION_NONE); |
| 307 COMPILE_ASSERT_PRINT_SCALING_MATCHING_ENUM( | 307 COMPILE_ASSERT_PRINT_SCALING_MATCHING_ENUM( |
| 308 WebKit::WebPrintScalingOptionFitToPrintableArea, | 308 blink::WebPrintScalingOptionFitToPrintableArea, |
| 309 PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA); | 309 PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA); |
| 310 COMPILE_ASSERT_PRINT_SCALING_MATCHING_ENUM( | 310 COMPILE_ASSERT_PRINT_SCALING_MATCHING_ENUM( |
| 311 WebKit::WebPrintScalingOptionSourceSize, PP_PRINTSCALINGOPTION_SOURCE_SIZE); | 311 blink::WebPrintScalingOptionSourceSize, PP_PRINTSCALINGOPTION_SOURCE_SIZE); |
| 312 | 312 |
| 313 // Sets |*security_origin| to be the WebKit security origin associated with the | 313 // Sets |*security_origin| to be the WebKit security origin associated with the |
| 314 // document containing the given plugin instance. On success, returns true. If | 314 // document containing the given plugin instance. On success, returns true. If |
| 315 // the instance is invalid, returns false and |*security_origin| will be | 315 // the instance is invalid, returns false and |*security_origin| will be |
| 316 // unchanged. | 316 // unchanged. |
| 317 bool SecurityOriginForInstance(PP_Instance instance_id, | 317 bool SecurityOriginForInstance(PP_Instance instance_id, |
| 318 WebKit::WebSecurityOrigin* security_origin) { | 318 blink::WebSecurityOrigin* security_origin) { |
| 319 PepperPluginInstanceImpl* instance = | 319 PepperPluginInstanceImpl* instance = |
| 320 HostGlobals::Get()->GetInstance(instance_id); | 320 HostGlobals::Get()->GetInstance(instance_id); |
| 321 if (!instance) | 321 if (!instance) |
| 322 return false; | 322 return false; |
| 323 | 323 |
| 324 WebElement plugin_element = instance->container()->element(); | 324 WebElement plugin_element = instance->container()->element(); |
| 325 *security_origin = plugin_element.document().securityOrigin(); | 325 *security_origin = plugin_element.document().securityOrigin(); |
| 326 return true; | 326 return true; |
| 327 } | 327 } |
| 328 | 328 |
| 329 // Convert the given vector to an array of C-strings. The strings in the | 329 // Convert the given vector to an array of C-strings. The strings in the |
| 330 // returned vector are only guaranteed valid so long as the vector of strings | 330 // returned vector are only guaranteed valid so long as the vector of strings |
| 331 // is not modified. | 331 // is not modified. |
| 332 scoped_ptr<const char*[]> StringVectorToArgArray( | 332 scoped_ptr<const char*[]> StringVectorToArgArray( |
| 333 const std::vector<std::string>& vector) { | 333 const std::vector<std::string>& vector) { |
| 334 scoped_ptr<const char*[]> array(new const char*[vector.size()]); | 334 scoped_ptr<const char*[]> array(new const char*[vector.size()]); |
| 335 for (size_t i = 0; i < vector.size(); ++i) | 335 for (size_t i = 0; i < vector.size(); ++i) |
| 336 array[i] = vector[i].c_str(); | 336 array[i] = vector[i].c_str(); |
| 337 return array.Pass(); | 337 return array.Pass(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 // Returns true if this is a "system reserved" key which should not be sent to | 340 // Returns true if this is a "system reserved" key which should not be sent to |
| 341 // a plugin. Some poorly behaving plugins (like Flash) incorrectly report that | 341 // a plugin. Some poorly behaving plugins (like Flash) incorrectly report that |
| 342 // they handle all keys sent to them. This can prevent keystrokes from working | 342 // they handle all keys sent to them. This can prevent keystrokes from working |
| 343 // for things like screen brightness and volume control. | 343 // for things like screen brightness and volume control. |
| 344 bool IsReservedSystemInputEvent(const WebKit::WebInputEvent& event) { | 344 bool IsReservedSystemInputEvent(const blink::WebInputEvent& event) { |
| 345 #if defined(OS_CHROMEOS) | 345 #if defined(OS_CHROMEOS) |
| 346 if (event.type != WebInputEvent::KeyDown && | 346 if (event.type != WebInputEvent::KeyDown && |
| 347 event.type != WebInputEvent::KeyUp) | 347 event.type != WebInputEvent::KeyUp) |
| 348 return false; | 348 return false; |
| 349 const WebKit::WebKeyboardEvent& key_event = | 349 const blink::WebKeyboardEvent& key_event = |
| 350 static_cast<const WebKit::WebKeyboardEvent&>(event); | 350 static_cast<const blink::WebKeyboardEvent&>(event); |
| 351 switch (key_event.windowsKeyCode) { | 351 switch (key_event.windowsKeyCode) { |
| 352 case ui::VKEY_BRIGHTNESS_DOWN: | 352 case ui::VKEY_BRIGHTNESS_DOWN: |
| 353 case ui::VKEY_BRIGHTNESS_UP: | 353 case ui::VKEY_BRIGHTNESS_UP: |
| 354 case ui::VKEY_KBD_BRIGHTNESS_DOWN: | 354 case ui::VKEY_KBD_BRIGHTNESS_DOWN: |
| 355 case ui::VKEY_KBD_BRIGHTNESS_UP: | 355 case ui::VKEY_KBD_BRIGHTNESS_UP: |
| 356 case ui::VKEY_VOLUME_MUTE: | 356 case ui::VKEY_VOLUME_MUTE: |
| 357 case ui::VKEY_VOLUME_DOWN: | 357 case ui::VKEY_VOLUME_DOWN: |
| 358 case ui::VKEY_VOLUME_UP: | 358 case ui::VKEY_VOLUME_UP: |
| 359 return true; | 359 return true; |
| 360 default: | 360 default: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 371 | 371 |
| 372 virtual void OnLockMouseACK(bool succeeded) OVERRIDE { | 372 virtual void OnLockMouseACK(bool succeeded) OVERRIDE { |
| 373 plugin_->OnLockMouseACK(succeeded); | 373 plugin_->OnLockMouseACK(succeeded); |
| 374 } | 374 } |
| 375 | 375 |
| 376 virtual void OnMouseLockLost() OVERRIDE { | 376 virtual void OnMouseLockLost() OVERRIDE { |
| 377 plugin_->OnMouseLockLost(); | 377 plugin_->OnMouseLockLost(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 virtual bool HandleMouseLockedInputEvent( | 380 virtual bool HandleMouseLockedInputEvent( |
| 381 const WebKit::WebMouseEvent &event) OVERRIDE { | 381 const blink::WebMouseEvent &event) OVERRIDE { |
| 382 plugin_->HandleMouseLockedInputEvent(event); | 382 plugin_->HandleMouseLockedInputEvent(event); |
| 383 return true; | 383 return true; |
| 384 } | 384 } |
| 385 | 385 |
| 386 private: | 386 private: |
| 387 PepperPluginInstanceImpl* plugin_; | 387 PepperPluginInstanceImpl* plugin_; |
| 388 }; | 388 }; |
| 389 | 389 |
| 390 | 390 |
| 391 } // namespace | 391 } // namespace |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 PepperPluginInstanceImpl::GamepadImpl::~GamepadImpl() { | 459 PepperPluginInstanceImpl::GamepadImpl::~GamepadImpl() { |
| 460 } | 460 } |
| 461 | 461 |
| 462 PPB_Gamepad_API* PepperPluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() { | 462 PPB_Gamepad_API* PepperPluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() { |
| 463 return this; | 463 return this; |
| 464 } | 464 } |
| 465 | 465 |
| 466 void PepperPluginInstanceImpl::GamepadImpl::Sample( | 466 void PepperPluginInstanceImpl::GamepadImpl::Sample( |
| 467 PP_Instance instance, | 467 PP_Instance instance, |
| 468 PP_GamepadsSampleData* data) { | 468 PP_GamepadsSampleData* data) { |
| 469 WebKit::WebGamepads webkit_data; | 469 blink::WebGamepads webkit_data; |
| 470 RenderThreadImpl::current()->SampleGamepads(&webkit_data); | 470 RenderThreadImpl::current()->SampleGamepads(&webkit_data); |
| 471 ConvertWebKitGamepadData( | 471 ConvertWebKitGamepadData( |
| 472 bit_cast<ppapi::WebKitGamepads>(webkit_data), data); | 472 bit_cast<ppapi::WebKitGamepads>(webkit_data), data); |
| 473 } | 473 } |
| 474 | 474 |
| 475 PepperPluginInstanceImpl::PepperPluginInstanceImpl( | 475 PepperPluginInstanceImpl::PepperPluginInstanceImpl( |
| 476 RenderViewImpl* render_view, | 476 RenderViewImpl* render_view, |
| 477 PluginModule* module, | 477 PluginModule* module, |
| 478 ppapi::PPP_Instance_Combined* instance_interface, | 478 ppapi::PPP_Instance_Combined* instance_interface, |
| 479 WebPluginContainer* container, | 479 WebPluginContainer* container, |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 bool success = PP_ToBool(instance_interface_->DidCreate(pp_instance(), | 762 bool success = PP_ToBool(instance_interface_->DidCreate(pp_instance(), |
| 763 argn_.size(), | 763 argn_.size(), |
| 764 argn_array.get(), | 764 argn_array.get(), |
| 765 argv_array.get())); | 765 argv_array.get())); |
| 766 if (success) | 766 if (success) |
| 767 message_channel_->StopQueueingJavaScriptMessages(); | 767 message_channel_->StopQueueingJavaScriptMessages(); |
| 768 return success; | 768 return success; |
| 769 } | 769 } |
| 770 | 770 |
| 771 bool PepperPluginInstanceImpl::HandleDocumentLoad( | 771 bool PepperPluginInstanceImpl::HandleDocumentLoad( |
| 772 const WebKit::WebURLResponse& response) { | 772 const blink::WebURLResponse& response) { |
| 773 DCHECK(!document_loader_); | 773 DCHECK(!document_loader_); |
| 774 if (external_document_load_) { | 774 if (external_document_load_) { |
| 775 // The external proxy isn't available, so save the response and record | 775 // The external proxy isn't available, so save the response and record |
| 776 // document load notifications for later replay. | 776 // document load notifications for later replay. |
| 777 external_document_response_ = response; | 777 external_document_response_ = response; |
| 778 external_document_loader_.reset(new ExternalDocumentLoader()); | 778 external_document_loader_.reset(new ExternalDocumentLoader()); |
| 779 document_loader_ = external_document_loader_.get(); | 779 document_loader_ = external_document_loader_.get(); |
| 780 return true; | 780 return true; |
| 781 } | 781 } |
| 782 | 782 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 pending_host_id)); | 818 pending_host_id)); |
| 819 | 819 |
| 820 // If the load was not abandoned, document_loader_ will now be set. It's | 820 // If the load was not abandoned, document_loader_ will now be set. It's |
| 821 // possible that the load was canceled by now and document_loader_ was | 821 // possible that the load was canceled by now and document_loader_ was |
| 822 // already nulled out. | 822 // already nulled out. |
| 823 return true; | 823 return true; |
| 824 } | 824 } |
| 825 | 825 |
| 826 bool PepperPluginInstanceImpl::SendCompositionEventToPlugin( | 826 bool PepperPluginInstanceImpl::SendCompositionEventToPlugin( |
| 827 PP_InputEvent_Type type, const base::string16& text) { | 827 PP_InputEvent_Type type, const base::string16& text) { |
| 828 std::vector<WebKit::WebCompositionUnderline> empty; | 828 std::vector<blink::WebCompositionUnderline> empty; |
| 829 return SendCompositionEventWithUnderlineInformationToPlugin( | 829 return SendCompositionEventWithUnderlineInformationToPlugin( |
| 830 type, text, empty, static_cast<int>(text.size()), | 830 type, text, empty, static_cast<int>(text.size()), |
| 831 static_cast<int>(text.size())); | 831 static_cast<int>(text.size())); |
| 832 } | 832 } |
| 833 | 833 |
| 834 bool PepperPluginInstanceImpl:: | 834 bool PepperPluginInstanceImpl:: |
| 835 SendCompositionEventWithUnderlineInformationToPlugin( | 835 SendCompositionEventWithUnderlineInformationToPlugin( |
| 836 PP_InputEvent_Type type, | 836 PP_InputEvent_Type type, |
| 837 const base::string16& text, | 837 const base::string16& text, |
| 838 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 838 const std::vector<blink::WebCompositionUnderline>& underlines, |
| 839 int selection_start, | 839 int selection_start, |
| 840 int selection_end) { | 840 int selection_end) { |
| 841 // Keep a reference on the stack. See NOTE above. | 841 // Keep a reference on the stack. See NOTE above. |
| 842 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 842 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 843 | 843 |
| 844 if (!LoadInputEventInterface()) | 844 if (!LoadInputEventInterface()) |
| 845 return false; | 845 return false; |
| 846 | 846 |
| 847 PP_InputEvent_Class event_class = PP_INPUTEVENT_CLASS_IME; | 847 PP_InputEvent_Class event_class = PP_INPUTEVENT_CLASS_IME; |
| 848 if (!(filtered_input_event_mask_ & event_class) && | 848 if (!(filtered_input_event_mask_ & event_class) && |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 } | 917 } |
| 918 | 918 |
| 919 bool PepperPluginInstanceImpl::HandleCompositionStart( | 919 bool PepperPluginInstanceImpl::HandleCompositionStart( |
| 920 const base::string16& text) { | 920 const base::string16& text) { |
| 921 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, | 921 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, |
| 922 text); | 922 text); |
| 923 } | 923 } |
| 924 | 924 |
| 925 bool PepperPluginInstanceImpl::HandleCompositionUpdate( | 925 bool PepperPluginInstanceImpl::HandleCompositionUpdate( |
| 926 const base::string16& text, | 926 const base::string16& text, |
| 927 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 927 const std::vector<blink::WebCompositionUnderline>& underlines, |
| 928 int selection_start, | 928 int selection_start, |
| 929 int selection_end) { | 929 int selection_end) { |
| 930 return SendCompositionEventWithUnderlineInformationToPlugin( | 930 return SendCompositionEventWithUnderlineInformationToPlugin( |
| 931 PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE, | 931 PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE, |
| 932 text, underlines, selection_start, selection_end); | 932 text, underlines, selection_start, selection_end); |
| 933 } | 933 } |
| 934 | 934 |
| 935 bool PepperPluginInstanceImpl::HandleCompositionEnd( | 935 bool PepperPluginInstanceImpl::HandleCompositionEnd( |
| 936 const base::string16& text) { | 936 const base::string16& text) { |
| 937 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_END, | 937 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_END, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 // TODO(kinaba) Take bounding_box into account. On some platforms, an | 972 // TODO(kinaba) Take bounding_box into account. On some platforms, an |
| 973 // "exclude rectangle" where candidate window must avoid the region can be | 973 // "exclude rectangle" where candidate window must avoid the region can be |
| 974 // passed to IME. Currently, we pass only the caret rectangle because | 974 // passed to IME. Currently, we pass only the caret rectangle because |
| 975 // it is the only information supported uniformly in Chromium. | 975 // it is the only information supported uniformly in Chromium. |
| 976 gfx::Rect caret(text_input_caret_); | 976 gfx::Rect caret(text_input_caret_); |
| 977 caret.Offset(view_data_.rect.point.x, view_data_.rect.point.y); | 977 caret.Offset(view_data_.rect.point.x, view_data_.rect.point.y); |
| 978 return caret; | 978 return caret; |
| 979 } | 979 } |
| 980 | 980 |
| 981 bool PepperPluginInstanceImpl::HandleInputEvent( | 981 bool PepperPluginInstanceImpl::HandleInputEvent( |
| 982 const WebKit::WebInputEvent& event, | 982 const blink::WebInputEvent& event, |
| 983 WebCursorInfo* cursor_info) { | 983 WebCursorInfo* cursor_info) { |
| 984 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleInputEvent"); | 984 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleInputEvent"); |
| 985 | 985 |
| 986 if (WebInputEvent::isMouseEventType(event.type)) { | 986 if (WebInputEvent::isMouseEventType(event.type)) { |
| 987 render_view_->PepperDidReceiveMouseEvent(this); | 987 render_view_->PepperDidReceiveMouseEvent(this); |
| 988 } | 988 } |
| 989 | 989 |
| 990 // Don't dispatch input events to crashed plugins. | 990 // Don't dispatch input events to crashed plugins. |
| 991 if (module()->is_crashed()) | 991 if (module()->is_crashed()) |
| 992 return false; | 992 return false; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 // instance_interface_ may have been cleared in Delete() if the | 1441 // instance_interface_ may have been cleared in Delete() if the |
| 1442 // PepperWebPluginImpl is destroyed. | 1442 // PepperWebPluginImpl is destroyed. |
| 1443 if (instance_interface_) | 1443 if (instance_interface_) |
| 1444 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); | 1444 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 void PepperPluginInstanceImpl::UpdateTouchEventRequest() { | 1447 void PepperPluginInstanceImpl::UpdateTouchEventRequest() { |
| 1448 bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || | 1448 bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || |
| 1449 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); | 1449 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); |
| 1450 container_->requestTouchEventType(raw_touch ? | 1450 container_->requestTouchEventType(raw_touch ? |
| 1451 WebKit::WebPluginContainer::TouchEventRequestTypeRaw : | 1451 blink::WebPluginContainer::TouchEventRequestTypeRaw : |
| 1452 WebKit::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse); | 1452 blink::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 bool PepperPluginInstanceImpl::IsAcceptingWheelEvents() const { | 1455 bool PepperPluginInstanceImpl::IsAcceptingWheelEvents() const { |
| 1456 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) || | 1456 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) || |
| 1457 (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL); | 1457 (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL); |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 void PepperPluginInstanceImpl::ScheduleAsyncDidChangeView() { | 1460 void PepperPluginInstanceImpl::ScheduleAsyncDidChangeView() { |
| 1461 if (view_change_weak_ptr_factory_.HasWeakPtrs()) | 1461 if (view_change_weak_ptr_factory_.HasWeakPtrs()) |
| 1462 return; // Already scheduled. | 1462 return; // Already scheduled. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 &print_settings); | 1568 &print_settings); |
| 1569 if (!num_pages) | 1569 if (!num_pages) |
| 1570 return 0; | 1570 return 0; |
| 1571 current_print_settings_ = print_settings; | 1571 current_print_settings_ = print_settings; |
| 1572 canvas_.clear(); | 1572 canvas_.clear(); |
| 1573 ranges_.clear(); | 1573 ranges_.clear(); |
| 1574 return num_pages; | 1574 return num_pages; |
| 1575 } | 1575 } |
| 1576 | 1576 |
| 1577 bool PepperPluginInstanceImpl::PrintPage(int page_number, | 1577 bool PepperPluginInstanceImpl::PrintPage(int page_number, |
| 1578 WebKit::WebCanvas* canvas) { | 1578 blink::WebCanvas* canvas) { |
| 1579 #if defined(ENABLE_FULL_PRINTING) | 1579 #if defined(ENABLE_FULL_PRINTING) |
| 1580 DCHECK(plugin_print_interface_); | 1580 DCHECK(plugin_print_interface_); |
| 1581 PP_PrintPageNumberRange_Dev page_range; | 1581 PP_PrintPageNumberRange_Dev page_range; |
| 1582 page_range.first_page_number = page_range.last_page_number = page_number; | 1582 page_range.first_page_number = page_range.last_page_number = page_number; |
| 1583 // The canvas only has a metafile on it for print preview. | 1583 // The canvas only has a metafile on it for print preview. |
| 1584 bool save_for_later = | 1584 bool save_for_later = |
| 1585 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL); | 1585 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL); |
| 1586 #if defined(OS_MACOSX) || defined(OS_WIN) | 1586 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 1587 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas); | 1587 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas); |
| 1588 #endif | 1588 #endif |
| 1589 if (save_for_later) { | 1589 if (save_for_later) { |
| 1590 ranges_.push_back(page_range); | 1590 ranges_.push_back(page_range); |
| 1591 canvas_ = skia::SharePtr(canvas); | 1591 canvas_ = skia::SharePtr(canvas); |
| 1592 return true; | 1592 return true; |
| 1593 } else { | 1593 } else { |
| 1594 return PrintPageHelper(&page_range, 1, canvas); | 1594 return PrintPageHelper(&page_range, 1, canvas); |
| 1595 } | 1595 } |
| 1596 #else // defined(ENABLED_PRINTING) | 1596 #else // defined(ENABLED_PRINTING) |
| 1597 return false; | 1597 return false; |
| 1598 #endif | 1598 #endif |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 bool PepperPluginInstanceImpl::PrintPageHelper( | 1601 bool PepperPluginInstanceImpl::PrintPageHelper( |
| 1602 PP_PrintPageNumberRange_Dev* page_ranges, | 1602 PP_PrintPageNumberRange_Dev* page_ranges, |
| 1603 int num_ranges, | 1603 int num_ranges, |
| 1604 WebKit::WebCanvas* canvas) { | 1604 blink::WebCanvas* canvas) { |
| 1605 // Keep a reference on the stack. See NOTE above. | 1605 // Keep a reference on the stack. See NOTE above. |
| 1606 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1606 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 1607 DCHECK(plugin_print_interface_); | 1607 DCHECK(plugin_print_interface_); |
| 1608 if (!plugin_print_interface_) | 1608 if (!plugin_print_interface_) |
| 1609 return false; | 1609 return false; |
| 1610 PP_Resource print_output = plugin_print_interface_->PrintPages( | 1610 PP_Resource print_output = plugin_print_interface_->PrintPages( |
| 1611 pp_instance(), page_ranges, num_ranges); | 1611 pp_instance(), page_ranges, num_ranges); |
| 1612 if (!print_output) | 1612 if (!print_output) |
| 1613 return false; | 1613 return false; |
| 1614 | 1614 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 if (!frame) | 1748 if (!frame) |
| 1749 return false; | 1749 return false; |
| 1750 WebView* view = frame->view(); | 1750 WebView* view = frame->view(); |
| 1751 if (!view) | 1751 if (!view) |
| 1752 return false; | 1752 return false; |
| 1753 | 1753 |
| 1754 return view->isAcceleratedCompositingActive(); | 1754 return view->isAcceleratedCompositingActive(); |
| 1755 } | 1755 } |
| 1756 | 1756 |
| 1757 bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, | 1757 bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, |
| 1758 WebKit::WebCanvas* canvas) { | 1758 blink::WebCanvas* canvas) { |
| 1759 #if defined(ENABLE_FULL_PRINTING) | 1759 #if defined(ENABLE_FULL_PRINTING) |
| 1760 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); | 1760 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); |
| 1761 if (enter.failed()) | 1761 if (enter.failed()) |
| 1762 return false; | 1762 return false; |
| 1763 | 1763 |
| 1764 BufferAutoMapper mapper(enter.object()); | 1764 BufferAutoMapper mapper(enter.object()); |
| 1765 if (!mapper.data() || !mapper.size()) { | 1765 if (!mapper.data() || !mapper.size()) { |
| 1766 NOTREACHED(); | 1766 NOTREACHED(); |
| 1767 return false; | 1767 return false; |
| 1768 } | 1768 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1952 if (TrackedCallback::IsPending(lock_mouse_callback_)) | 1952 if (TrackedCallback::IsPending(lock_mouse_callback_)) |
| 1953 lock_mouse_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); | 1953 lock_mouse_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); |
| 1954 } | 1954 } |
| 1955 | 1955 |
| 1956 void PepperPluginInstanceImpl::OnMouseLockLost() { | 1956 void PepperPluginInstanceImpl::OnMouseLockLost() { |
| 1957 if (LoadMouseLockInterface()) | 1957 if (LoadMouseLockInterface()) |
| 1958 plugin_mouse_lock_interface_->MouseLockLost(pp_instance()); | 1958 plugin_mouse_lock_interface_->MouseLockLost(pp_instance()); |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 void PepperPluginInstanceImpl::HandleMouseLockedInputEvent( | 1961 void PepperPluginInstanceImpl::HandleMouseLockedInputEvent( |
| 1962 const WebKit::WebMouseEvent& event) { | 1962 const blink::WebMouseEvent& event) { |
| 1963 // |cursor_info| is ignored since it is hidden when the mouse is locked. | 1963 // |cursor_info| is ignored since it is hidden when the mouse is locked. |
| 1964 WebKit::WebCursorInfo cursor_info; | 1964 blink::WebCursorInfo cursor_info; |
| 1965 HandleInputEvent(event, &cursor_info); | 1965 HandleInputEvent(event, &cursor_info); |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 void PepperPluginInstanceImpl::SimulateInputEvent( | 1968 void PepperPluginInstanceImpl::SimulateInputEvent( |
| 1969 const InputEventData& input_event) { | 1969 const InputEventData& input_event) { |
| 1970 WebView* web_view = container()->element().document().frame()->view(); | 1970 WebView* web_view = container()->element().document().frame()->view(); |
| 1971 if (!web_view) { | 1971 if (!web_view) { |
| 1972 NOTREACHED(); | 1972 NOTREACHED(); |
| 1973 return; | 1973 return; |
| 1974 } | 1974 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 std::vector<size_t> offsets; | 2014 std::vector<size_t> offsets; |
| 2015 offsets.push_back(input_event.composition_selection_start); | 2015 offsets.push_back(input_event.composition_selection_start); |
| 2016 offsets.push_back(input_event.composition_selection_end); | 2016 offsets.push_back(input_event.composition_selection_end); |
| 2017 offsets.insert(offsets.end(), | 2017 offsets.insert(offsets.end(), |
| 2018 input_event.composition_segment_offsets.begin(), | 2018 input_event.composition_segment_offsets.begin(), |
| 2019 input_event.composition_segment_offsets.end()); | 2019 input_event.composition_segment_offsets.end()); |
| 2020 | 2020 |
| 2021 base::string16 utf16_text = | 2021 base::string16 utf16_text = |
| 2022 base::UTF8ToUTF16AndAdjustOffsets(input_event.character_text, &offsets); | 2022 base::UTF8ToUTF16AndAdjustOffsets(input_event.character_text, &offsets); |
| 2023 | 2023 |
| 2024 std::vector<WebKit::WebCompositionUnderline> underlines; | 2024 std::vector<blink::WebCompositionUnderline> underlines; |
| 2025 for (size_t i = 2; i + 1 < offsets.size(); ++i) { | 2025 for (size_t i = 2; i + 1 < offsets.size(); ++i) { |
| 2026 WebKit::WebCompositionUnderline underline; | 2026 blink::WebCompositionUnderline underline; |
| 2027 underline.startOffset = offsets[i]; | 2027 underline.startOffset = offsets[i]; |
| 2028 underline.endOffset = offsets[i + 1]; | 2028 underline.endOffset = offsets[i + 1]; |
| 2029 if (input_event.composition_target_segment == static_cast<int32_t>(i - 2)) | 2029 if (input_event.composition_target_segment == static_cast<int32_t>(i - 2)) |
| 2030 underline.thick = true; | 2030 underline.thick = true; |
| 2031 underlines.push_back(underline); | 2031 underlines.push_back(underline); |
| 2032 } | 2032 } |
| 2033 | 2033 |
| 2034 render_view_->SimulateImeSetComposition( | 2034 render_view_->SimulateImeSetComposition( |
| 2035 utf16_text, underlines, offsets[0], offsets[1]); | 2035 utf16_text, underlines, offsets[0], offsets[1]); |
| 2036 } | 2036 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 // Get the current frame to pass to the evaluate function. | 2168 // Get the current frame to pass to the evaluate function. |
| 2169 WebFrame* frame = container_->element().document().frame(); | 2169 WebFrame* frame = container_->element().document().frame(); |
| 2170 if (!frame) { | 2170 if (!frame) { |
| 2171 try_catch.SetException("No frame to execute script in."); | 2171 try_catch.SetException("No frame to execute script in."); |
| 2172 return PP_MakeUndefined(); | 2172 return PP_MakeUndefined(); |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 NPVariant result; | 2175 NPVariant result; |
| 2176 bool ok = false; | 2176 bool ok = false; |
| 2177 if (IsProcessingUserGesture()) { | 2177 if (IsProcessingUserGesture()) { |
| 2178 WebKit::WebScopedUserGesture user_gesture(CurrentUserGestureToken()); | 2178 blink::WebScopedUserGesture user_gesture(CurrentUserGestureToken()); |
| 2179 ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, | 2179 ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, |
| 2180 &result); | 2180 &result); |
| 2181 } else { | 2181 } else { |
| 2182 ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, | 2182 ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, |
| 2183 &result); | 2183 &result); |
| 2184 } | 2184 } |
| 2185 if (!ok) { | 2185 if (!ok) { |
| 2186 // TryCatch doesn't catch the exceptions properly. Since this is only for | 2186 // TryCatch doesn't catch the exceptions properly. Since this is only for |
| 2187 // a trusted API, just set to a general exception message. | 2187 // a trusted API, just set to a general exception message. |
| 2188 try_catch.SetException("Exception caught"); | 2188 try_catch.SetException("Exception caught"); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2292 PP_Bool final_result) { | 2292 PP_Bool final_result) { |
| 2293 DCHECK_NE(find_identifier_, -1); | 2293 DCHECK_NE(find_identifier_, -1); |
| 2294 render_view_->reportFindInPageMatchCount( | 2294 render_view_->reportFindInPageMatchCount( |
| 2295 find_identifier_, total, PP_ToBool(final_result)); | 2295 find_identifier_, total, PP_ToBool(final_result)); |
| 2296 } | 2296 } |
| 2297 | 2297 |
| 2298 void PepperPluginInstanceImpl::SelectedFindResultChanged(PP_Instance instance, | 2298 void PepperPluginInstanceImpl::SelectedFindResultChanged(PP_Instance instance, |
| 2299 int32_t index) { | 2299 int32_t index) { |
| 2300 DCHECK_NE(find_identifier_, -1); | 2300 DCHECK_NE(find_identifier_, -1); |
| 2301 render_view_->reportFindInPageSelection( | 2301 render_view_->reportFindInPageSelection( |
| 2302 find_identifier_, index + 1, WebKit::WebRect()); | 2302 find_identifier_, index + 1, blink::WebRect()); |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) { | 2305 PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) { |
| 2306 return PP_FromBool(view_data_.is_fullscreen); | 2306 return PP_FromBool(view_data_.is_fullscreen); |
| 2307 } | 2307 } |
| 2308 | 2308 |
| 2309 PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance, | 2309 PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance, |
| 2310 PP_Bool fullscreen) { | 2310 PP_Bool fullscreen) { |
| 2311 return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen))); | 2311 return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen))); |
| 2312 } | 2312 } |
| 2313 | 2313 |
| 2314 PP_Bool PepperPluginInstanceImpl::GetScreenSize(PP_Instance instance, | 2314 PP_Bool PepperPluginInstanceImpl::GetScreenSize(PP_Instance instance, |
| 2315 PP_Size* size) { | 2315 PP_Size* size) { |
| 2316 WebKit::WebScreenInfo info = render_view_->screenInfo(); | 2316 blink::WebScreenInfo info = render_view_->screenInfo(); |
| 2317 *size = PP_MakeSize(info.rect.width, info.rect.height); | 2317 *size = PP_MakeSize(info.rect.width, info.rect.height); |
| 2318 return PP_TRUE; | 2318 return PP_TRUE; |
| 2319 } | 2319 } |
| 2320 | 2320 |
| 2321 ppapi::Resource* PepperPluginInstanceImpl::GetSingletonResource( | 2321 ppapi::Resource* PepperPluginInstanceImpl::GetSingletonResource( |
| 2322 PP_Instance instance, | 2322 PP_Instance instance, |
| 2323 ppapi::SingletonResourceID id) { | 2323 ppapi::SingletonResourceID id) { |
| 2324 // Flash APIs and some others aren't implemented in-process. | 2324 // Flash APIs and some others aren't implemented in-process. |
| 2325 switch (id) { | 2325 switch (id) { |
| 2326 case ppapi::BROKER_SINGLETON_ID: | 2326 case ppapi::BROKER_SINGLETON_ID: |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 document_url.Resolve(relative_string->value()), | 2530 document_url.Resolve(relative_string->value()), |
| 2531 components); | 2531 components); |
| 2532 } | 2532 } |
| 2533 | 2533 |
| 2534 PP_Bool PepperPluginInstanceImpl::DocumentCanRequest(PP_Instance instance, | 2534 PP_Bool PepperPluginInstanceImpl::DocumentCanRequest(PP_Instance instance, |
| 2535 PP_Var url) { | 2535 PP_Var url) { |
| 2536 StringVar* url_string = StringVar::FromPPVar(url); | 2536 StringVar* url_string = StringVar::FromPPVar(url); |
| 2537 if (!url_string) | 2537 if (!url_string) |
| 2538 return PP_FALSE; | 2538 return PP_FALSE; |
| 2539 | 2539 |
| 2540 WebKit::WebSecurityOrigin security_origin; | 2540 blink::WebSecurityOrigin security_origin; |
| 2541 if (!SecurityOriginForInstance(instance, &security_origin)) | 2541 if (!SecurityOriginForInstance(instance, &security_origin)) |
| 2542 return PP_FALSE; | 2542 return PP_FALSE; |
| 2543 | 2543 |
| 2544 GURL gurl(url_string->value()); | 2544 GURL gurl(url_string->value()); |
| 2545 if (!gurl.is_valid()) | 2545 if (!gurl.is_valid()) |
| 2546 return PP_FALSE; | 2546 return PP_FALSE; |
| 2547 | 2547 |
| 2548 return BoolToPPBool(security_origin.canRequest(gurl)); | 2548 return BoolToPPBool(security_origin.canRequest(gurl)); |
| 2549 } | 2549 } |
| 2550 | 2550 |
| 2551 PP_Bool PepperPluginInstanceImpl::DocumentCanAccessDocument( | 2551 PP_Bool PepperPluginInstanceImpl::DocumentCanAccessDocument( |
| 2552 PP_Instance instance, | 2552 PP_Instance instance, |
| 2553 PP_Instance target) { | 2553 PP_Instance target) { |
| 2554 WebKit::WebSecurityOrigin our_origin; | 2554 blink::WebSecurityOrigin our_origin; |
| 2555 if (!SecurityOriginForInstance(instance, &our_origin)) | 2555 if (!SecurityOriginForInstance(instance, &our_origin)) |
| 2556 return PP_FALSE; | 2556 return PP_FALSE; |
| 2557 | 2557 |
| 2558 WebKit::WebSecurityOrigin target_origin; | 2558 blink::WebSecurityOrigin target_origin; |
| 2559 if (!SecurityOriginForInstance(instance, &target_origin)) | 2559 if (!SecurityOriginForInstance(instance, &target_origin)) |
| 2560 return PP_FALSE; | 2560 return PP_FALSE; |
| 2561 | 2561 |
| 2562 return BoolToPPBool(our_origin.canAccess(target_origin)); | 2562 return BoolToPPBool(our_origin.canAccess(target_origin)); |
| 2563 } | 2563 } |
| 2564 | 2564 |
| 2565 PP_Var PepperPluginInstanceImpl::GetDocumentURL( | 2565 PP_Var PepperPluginInstanceImpl::GetDocumentURL( |
| 2566 PP_Instance instance, | 2566 PP_Instance instance, |
| 2567 PP_URLComponents_Dev* components) { | 2567 PP_URLComponents_Dev* components) { |
| 2568 WebKit::WebDocument document = container()->element().document(); | 2568 blink::WebDocument document = container()->element().document(); |
| 2569 return ppapi::PPB_URLUtil_Shared::GenerateURLReturn(document.url(), | 2569 return ppapi::PPB_URLUtil_Shared::GenerateURLReturn(document.url(), |
| 2570 components); | 2570 components); |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 PP_Var PepperPluginInstanceImpl::GetPluginInstanceURL( | 2573 PP_Var PepperPluginInstanceImpl::GetPluginInstanceURL( |
| 2574 PP_Instance instance, | 2574 PP_Instance instance, |
| 2575 PP_URLComponents_Dev* components) { | 2575 PP_URLComponents_Dev* components) { |
| 2576 return ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, | 2576 return ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, |
| 2577 components); | 2577 components); |
| 2578 } | 2578 } |
| 2579 | 2579 |
| 2580 PP_Var PepperPluginInstanceImpl::GetPluginReferrerURL( | 2580 PP_Var PepperPluginInstanceImpl::GetPluginReferrerURL( |
| 2581 PP_Instance instance, | 2581 PP_Instance instance, |
| 2582 PP_URLComponents_Dev* components) { | 2582 PP_URLComponents_Dev* components) { |
| 2583 WebKit::WebDocument document = container()->element().document(); | 2583 blink::WebDocument document = container()->element().document(); |
| 2584 if (!full_frame_) | 2584 if (!full_frame_) |
| 2585 return ppapi::PPB_URLUtil_Shared::GenerateURLReturn(document.url(), | 2585 return ppapi::PPB_URLUtil_Shared::GenerateURLReturn(document.url(), |
| 2586 components); | 2586 components); |
| 2587 WebFrame* frame = document.frame(); | 2587 WebFrame* frame = document.frame(); |
| 2588 if (!frame) | 2588 if (!frame) |
| 2589 return PP_MakeUndefined(); | 2589 return PP_MakeUndefined(); |
| 2590 const WebURLRequest& request = frame->dataSource()->originalRequest(); | 2590 const WebURLRequest& request = frame->dataSource()->originalRequest(); |
| 2591 WebString referer = request.httpHeaderField("Referer"); | 2591 WebString referer = request.httpHeaderField("Referer"); |
| 2592 if (referer.isEmpty()) | 2592 if (referer.isEmpty()) |
| 2593 return PP_MakeUndefined(); | 2593 return PP_MakeUndefined(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 sent_initial_did_change_view_ = false; | 2650 sent_initial_did_change_view_ = false; |
| 2651 view_change_weak_ptr_factory_.InvalidateWeakPtrs(); | 2651 view_change_weak_ptr_factory_.InvalidateWeakPtrs(); |
| 2652 SendDidChangeView(); | 2652 SendDidChangeView(); |
| 2653 | 2653 |
| 2654 DCHECK(external_document_load_); | 2654 DCHECK(external_document_load_); |
| 2655 external_document_load_ = false; | 2655 external_document_load_ = false; |
| 2656 if (!external_document_response_.isNull()) { | 2656 if (!external_document_response_.isNull()) { |
| 2657 document_loader_ = NULL; | 2657 document_loader_ = NULL; |
| 2658 // Pass the response to the new proxy. | 2658 // Pass the response to the new proxy. |
| 2659 HandleDocumentLoad(external_document_response_); | 2659 HandleDocumentLoad(external_document_response_); |
| 2660 external_document_response_ = WebKit::WebURLResponse(); | 2660 external_document_response_ = blink::WebURLResponse(); |
| 2661 // Replay any document load events we've received to the real loader. | 2661 // Replay any document load events we've received to the real loader. |
| 2662 external_document_loader_->ReplayReceivedData(document_loader_); | 2662 external_document_loader_->ReplayReceivedData(document_loader_); |
| 2663 external_document_loader_.reset(NULL); | 2663 external_document_loader_.reset(NULL); |
| 2664 } | 2664 } |
| 2665 | 2665 |
| 2666 return PP_EXTERNAL_PLUGIN_OK; | 2666 return PP_EXTERNAL_PLUGIN_OK; |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 bool PepperPluginInstanceImpl::IsValidInstanceOf(PluginModule* module) { | 2669 bool PepperPluginInstanceImpl::IsValidInstanceOf(PluginModule* module) { |
| 2670 DCHECK(module); | 2670 DCHECK(module); |
| 2671 return module == module_.get() || | 2671 return module == module_.get() || |
| 2672 module == original_module_.get(); | 2672 module == original_module_.get(); |
| 2673 } | 2673 } |
| 2674 | 2674 |
| 2675 NPP PepperPluginInstanceImpl::instanceNPP() { | 2675 NPP PepperPluginInstanceImpl::instanceNPP() { |
| 2676 return npp_.get(); | 2676 return npp_.get(); |
| 2677 } | 2677 } |
| 2678 | 2678 |
| 2679 PepperPluginInstance* PepperPluginInstance::Get(PP_Instance instance_id) { | 2679 PepperPluginInstance* PepperPluginInstance::Get(PP_Instance instance_id) { |
| 2680 return HostGlobals::Get()->GetInstance(instance_id); | 2680 return HostGlobals::Get()->GetInstance(instance_id); |
| 2681 } | 2681 } |
| 2682 | 2682 |
| 2683 RenderView* PepperPluginInstanceImpl::GetRenderView() { | 2683 RenderView* PepperPluginInstanceImpl::GetRenderView() { |
| 2684 return render_view_; | 2684 return render_view_; |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 WebKit::WebPluginContainer* PepperPluginInstanceImpl::GetContainer() { | 2687 blink::WebPluginContainer* PepperPluginInstanceImpl::GetContainer() { |
| 2688 return container_; | 2688 return container_; |
| 2689 } | 2689 } |
| 2690 | 2690 |
| 2691 v8::Isolate* PepperPluginInstanceImpl::GetIsolate() const { | 2691 v8::Isolate* PepperPluginInstanceImpl::GetIsolate() const { |
| 2692 return isolate_; | 2692 return isolate_; |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 ppapi::VarTracker* PepperPluginInstanceImpl::GetVarTracker() { | 2695 ppapi::VarTracker* PepperPluginInstanceImpl::GetVarTracker() { |
| 2696 return HostGlobals::Get()->GetVarTracker(); | 2696 return HostGlobals::Get()->GetVarTracker(); |
| 2697 } | 2697 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2882 RendererPpapiHostImpl* host_impl = module_->renderer_ppapi_host(); | 2882 RendererPpapiHostImpl* host_impl = module_->renderer_ppapi_host(); |
| 2883 PepperFileRefRendererHost* file_ref_host( | 2883 PepperFileRefRendererHost* file_ref_host( |
| 2884 new PepperFileRefRendererHost(host_impl, pp_instance(), 0, path)); | 2884 new PepperFileRefRendererHost(host_impl, pp_instance(), 0, path)); |
| 2885 return host_impl->GetPpapiHost()->AddPendingResourceHost( | 2885 return host_impl->GetPpapiHost()->AddPendingResourceHost( |
| 2886 scoped_ptr<ppapi::host::ResourceHost>(file_ref_host)); | 2886 scoped_ptr<ppapi::host::ResourceHost>(file_ref_host)); |
| 2887 } | 2887 } |
| 2888 | 2888 |
| 2889 bool PepperPluginInstanceImpl::CanAccessMainFrame() const { | 2889 bool PepperPluginInstanceImpl::CanAccessMainFrame() const { |
| 2890 if (!container_) | 2890 if (!container_) |
| 2891 return false; | 2891 return false; |
| 2892 WebKit::WebDocument containing_document = container_->element().document(); | 2892 blink::WebDocument containing_document = container_->element().document(); |
| 2893 | 2893 |
| 2894 if (!containing_document.frame() || | 2894 if (!containing_document.frame() || |
| 2895 !containing_document.frame()->view() || | 2895 !containing_document.frame()->view() || |
| 2896 !containing_document.frame()->view()->mainFrame()) { | 2896 !containing_document.frame()->view()->mainFrame()) { |
| 2897 return false; | 2897 return false; |
| 2898 } | 2898 } |
| 2899 WebKit::WebDocument main_document = | 2899 blink::WebDocument main_document = |
| 2900 containing_document.frame()->view()->mainFrame()->document(); | 2900 containing_document.frame()->view()->mainFrame()->document(); |
| 2901 | 2901 |
| 2902 return containing_document.securityOrigin().canAccess( | 2902 return containing_document.securityOrigin().canAccess( |
| 2903 main_document.securityOrigin()); | 2903 main_document.securityOrigin()); |
| 2904 } | 2904 } |
| 2905 | 2905 |
| 2906 void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() { | 2906 void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() { |
| 2907 WebElement element = container_->element(); | 2907 WebElement element = container_->element(); |
| 2908 width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); | 2908 width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); |
| 2909 height_before_fullscreen_ = | 2909 height_before_fullscreen_ = |
| 2910 element.getAttribute(WebString::fromUTF8(kHeight)); | 2910 element.getAttribute(WebString::fromUTF8(kHeight)); |
| 2911 border_before_fullscreen_ = | 2911 border_before_fullscreen_ = |
| 2912 element.getAttribute(WebString::fromUTF8(kBorder)); | 2912 element.getAttribute(WebString::fromUTF8(kBorder)); |
| 2913 style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle)); | 2913 style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle)); |
| 2914 } | 2914 } |
| 2915 | 2915 |
| 2916 void PepperPluginInstanceImpl::SetSizeAttributesForFullscreen() { | 2916 void PepperPluginInstanceImpl::SetSizeAttributesForFullscreen() { |
| 2917 WebKit::WebScreenInfo info = render_view_->screenInfo(); | 2917 blink::WebScreenInfo info = render_view_->screenInfo(); |
| 2918 screen_size_for_fullscreen_ = gfx::Size(info.rect.width, info.rect.height); | 2918 screen_size_for_fullscreen_ = gfx::Size(info.rect.width, info.rect.height); |
| 2919 std::string width = StringPrintf("%d", screen_size_for_fullscreen_.width()); | 2919 std::string width = StringPrintf("%d", screen_size_for_fullscreen_.width()); |
| 2920 std::string height = StringPrintf("%d", screen_size_for_fullscreen_.height()); | 2920 std::string height = StringPrintf("%d", screen_size_for_fullscreen_.height()); |
| 2921 | 2921 |
| 2922 WebElement element = container_->element(); | 2922 WebElement element = container_->element(); |
| 2923 element.setAttribute(WebString::fromUTF8(kWidth), WebString::fromUTF8(width)); | 2923 element.setAttribute(WebString::fromUTF8(kWidth), WebString::fromUTF8(width)); |
| 2924 element.setAttribute(WebString::fromUTF8(kHeight), | 2924 element.setAttribute(WebString::fromUTF8(kHeight), |
| 2925 WebString::fromUTF8(height)); | 2925 WebString::fromUTF8(height)); |
| 2926 element.setAttribute(WebString::fromUTF8(kBorder), WebString::fromUTF8("0")); | 2926 element.setAttribute(WebString::fromUTF8(kBorder), WebString::fromUTF8("0")); |
| 2927 | 2927 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2974 } | 2974 } |
| 2975 | 2975 |
| 2976 void PepperPluginInstanceImpl::UnSetAndDeleteLockTargetAdapter() { | 2976 void PepperPluginInstanceImpl::UnSetAndDeleteLockTargetAdapter() { |
| 2977 if (lock_target_.get()) { | 2977 if (lock_target_.get()) { |
| 2978 GetMouseLockDispatcher()->OnLockTargetDestroyed(lock_target_.get()); | 2978 GetMouseLockDispatcher()->OnLockTargetDestroyed(lock_target_.get()); |
| 2979 lock_target_.reset(); | 2979 lock_target_.reset(); |
| 2980 } | 2980 } |
| 2981 } | 2981 } |
| 2982 | 2982 |
| 2983 void PepperPluginInstanceImpl::DidDataFromWebURLResponse( | 2983 void PepperPluginInstanceImpl::DidDataFromWebURLResponse( |
| 2984 const WebKit::WebURLResponse& response, | 2984 const blink::WebURLResponse& response, |
| 2985 int pending_host_id, | 2985 int pending_host_id, |
| 2986 const ppapi::URLResponseInfoData& data) { | 2986 const ppapi::URLResponseInfoData& data) { |
| 2987 RendererPpapiHostImpl* host_impl = module_->renderer_ppapi_host(); | 2987 RendererPpapiHostImpl* host_impl = module_->renderer_ppapi_host(); |
| 2988 | 2988 |
| 2989 if (host_impl->in_process_router()) { | 2989 if (host_impl->in_process_router()) { |
| 2990 // Running in-process, we can just create the resource and call the | 2990 // Running in-process, we can just create the resource and call the |
| 2991 // PPP_Instance function directly. | 2991 // PPP_Instance function directly. |
| 2992 scoped_refptr<ppapi::proxy::URLLoaderResource> loader_resource( | 2992 scoped_refptr<ppapi::proxy::URLLoaderResource> loader_resource( |
| 2993 new ppapi::proxy::URLLoaderResource( | 2993 new ppapi::proxy::URLLoaderResource( |
| 2994 host_impl->in_process_router()->GetPluginConnection(pp_instance()), | 2994 host_impl->in_process_router()->GetPluginConnection(pp_instance()), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3006 // Running out-of-process. Initiate an IPC call to notify the plugin | 3006 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 3007 // process. | 3007 // process. |
| 3008 ppapi::proxy::HostDispatcher* dispatcher = | 3008 ppapi::proxy::HostDispatcher* dispatcher = |
| 3009 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3009 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 3010 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3010 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 3011 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3011 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 3012 } | 3012 } |
| 3013 } | 3013 } |
| 3014 | 3014 |
| 3015 } // namespace content | 3015 } // namespace content |
| OLD | NEW |