| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 // Mimics the order of events sent by WebKit. | 646 // Mimics the order of events sent by WebKit. |
| 647 // See WebCore::Editor::setComposition() for the corresponding code. | 647 // See WebCore::Editor::setComposition() for the corresponding code. |
| 648 render_view_->focused_pepper_plugin()->HandleCompositionEnd(last_text); | 648 render_view_->focused_pepper_plugin()->HandleCompositionEnd(last_text); |
| 649 render_view_->focused_pepper_plugin()->HandleTextInput(last_text); | 649 render_view_->focused_pepper_plugin()->HandleTextInput(last_text); |
| 650 } | 650 } |
| 651 pepper_composition_text_.clear(); | 651 pepper_composition_text_.clear(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 #endif // ENABLE_PLUGINS | 654 #endif // ENABLE_PLUGINS |
| 655 | 655 |
| 656 MediaStreamDispatcher* RenderFrameImpl::GetMediaStreamDispatcher() { |
| 657 if (!web_user_media_client_) |
| 658 InitializeUserMediaClient(); |
| 659 return web_user_media_client_ ? |
| 660 web_user_media_client_->media_stream_dispatcher() : NULL; |
| 661 } |
| 662 |
| 656 bool RenderFrameImpl::Send(IPC::Message* message) { | 663 bool RenderFrameImpl::Send(IPC::Message* message) { |
| 657 if (is_detaching_) { | 664 if (is_detaching_) { |
| 658 delete message; | 665 delete message; |
| 659 return false; | 666 return false; |
| 660 } | 667 } |
| 661 if (is_swapped_out_ || render_view_->is_swapped_out()) { | 668 if (is_swapped_out_ || render_view_->is_swapped_out()) { |
| 662 if (!SwappedOutMessages::CanSendWhileSwappedOut(message)) { | 669 if (!SwappedOutMessages::CanSendWhileSwappedOut(message)) { |
| 663 delete message; | 670 delete message; |
| 664 return false; | 671 return false; |
| 665 } | 672 } |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 } | 1570 } |
| 1564 } | 1571 } |
| 1565 | 1572 |
| 1566 void RenderFrameImpl::frameFocused() { | 1573 void RenderFrameImpl::frameFocused() { |
| 1567 Send(new FrameHostMsg_FrameFocused(routing_id_)); | 1574 Send(new FrameHostMsg_FrameFocused(routing_id_)); |
| 1568 } | 1575 } |
| 1569 | 1576 |
| 1570 void RenderFrameImpl::willClose(blink::WebFrame* frame) { | 1577 void RenderFrameImpl::willClose(blink::WebFrame* frame) { |
| 1571 DCHECK(!frame_ || frame_ == frame); | 1578 DCHECK(!frame_ || frame_ == frame); |
| 1572 | 1579 |
| 1580 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose()); |
| 1573 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 1581 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 1574 FrameWillClose(frame)); | 1582 FrameWillClose(frame)); |
| 1575 } | 1583 } |
| 1576 | 1584 |
| 1577 void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame, | 1585 void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame, |
| 1578 const blink::WebString& name) { | 1586 const blink::WebString& name) { |
| 1579 DCHECK(!frame_ || frame_ == frame); | 1587 DCHECK(!frame_ || frame_ == frame); |
| 1580 if (!render_view_->renderer_preferences_.report_frame_name_changes) | 1588 if (!render_view_->renderer_preferences_.report_frame_name_changes) |
| 1581 return; | 1589 return; |
| 1582 | 1590 |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 void RenderFrameImpl::willStartUsingPeerConnectionHandler( | 2777 void RenderFrameImpl::willStartUsingPeerConnectionHandler( |
| 2770 blink::WebLocalFrame* frame, | 2778 blink::WebLocalFrame* frame, |
| 2771 blink::WebRTCPeerConnectionHandler* handler) { | 2779 blink::WebRTCPeerConnectionHandler* handler) { |
| 2772 DCHECK(!frame_ || frame_ == frame); | 2780 DCHECK(!frame_ || frame_ == frame); |
| 2773 #if defined(ENABLE_WEBRTC) | 2781 #if defined(ENABLE_WEBRTC) |
| 2774 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); | 2782 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); |
| 2775 #endif | 2783 #endif |
| 2776 } | 2784 } |
| 2777 | 2785 |
| 2778 blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() { | 2786 blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() { |
| 2779 // This can happen in tests, in which case it's OK to return NULL. | 2787 if (!web_user_media_client_) |
| 2780 if (!InitializeUserMediaClient()) | 2788 InitializeUserMediaClient(); |
| 2781 return NULL; | |
| 2782 | |
| 2783 return web_user_media_client_; | 2789 return web_user_media_client_; |
| 2784 } | 2790 } |
| 2785 | 2791 |
| 2786 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() { | 2792 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() { |
| 2787 if (!midi_dispatcher_) | 2793 if (!midi_dispatcher_) |
| 2788 midi_dispatcher_ = new MidiDispatcher(this); | 2794 midi_dispatcher_ = new MidiDispatcher(this); |
| 2789 return midi_dispatcher_; | 2795 return midi_dispatcher_; |
| 2790 } | 2796 } |
| 2791 | 2797 |
| 2792 bool RenderFrameImpl::willCheckAndDispatchMessageEvent( | 2798 bool RenderFrameImpl::willCheckAndDispatchMessageEvent( |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3455 selection_text_ = text; | 3461 selection_text_ = text; |
| 3456 selection_text_offset_ = offset; | 3462 selection_text_offset_ = offset; |
| 3457 selection_range_ = range; | 3463 selection_range_ = range; |
| 3458 // This IPC is dispatched by RenderWidetHost, so use its routing ID. | 3464 // This IPC is dispatched by RenderWidetHost, so use its routing ID. |
| 3459 Send(new ViewHostMsg_SelectionChanged( | 3465 Send(new ViewHostMsg_SelectionChanged( |
| 3460 GetRenderWidget()->routing_id(), text, offset, range)); | 3466 GetRenderWidget()->routing_id(), text, offset, range)); |
| 3461 } | 3467 } |
| 3462 GetRenderWidget()->UpdateSelectionBounds(); | 3468 GetRenderWidget()->UpdateSelectionBounds(); |
| 3463 } | 3469 } |
| 3464 | 3470 |
| 3465 bool RenderFrameImpl::InitializeUserMediaClient() { | 3471 void RenderFrameImpl::InitializeUserMediaClient() { |
| 3466 if (web_user_media_client_) | |
| 3467 return true; | |
| 3468 | |
| 3469 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. | 3472 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. |
| 3470 return false; | 3473 return; |
| 3471 | 3474 |
| 3472 #if defined(OS_ANDROID) | 3475 #if defined(OS_ANDROID) |
| 3473 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) | 3476 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) |
| 3474 return false; | 3477 return; |
| 3475 #endif | 3478 #endif |
| 3476 | 3479 |
| 3477 #if defined(ENABLE_WEBRTC) | 3480 #if defined(ENABLE_WEBRTC) |
| 3478 if (!render_view_->media_stream_dispatcher_) { | 3481 DCHECK(!web_user_media_client_); |
| 3479 render_view_->media_stream_dispatcher_ = | 3482 web_user_media_client_ = new MediaStreamImpl( |
| 3480 new MediaStreamDispatcher(render_view_.get()); | 3483 this, |
| 3481 } | 3484 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(), |
| 3482 | 3485 make_scoped_ptr(new MediaStreamDispatcher(this)).Pass()); |
| 3483 MediaStreamImpl* media_stream_impl = new MediaStreamImpl( | |
| 3484 render_view_.get(), | |
| 3485 render_view_->media_stream_dispatcher_, | |
| 3486 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()); | |
| 3487 web_user_media_client_ = media_stream_impl; | |
| 3488 return true; | |
| 3489 #else | |
| 3490 return false; | |
| 3491 #endif | 3486 #endif |
| 3492 } | 3487 } |
| 3493 | 3488 |
| 3494 WebMediaPlayer* RenderFrameImpl::CreateWebMediaPlayerForMediaStream( | 3489 WebMediaPlayer* RenderFrameImpl::CreateWebMediaPlayerForMediaStream( |
| 3495 const blink::WebURL& url, | 3490 const blink::WebURL& url, |
| 3496 WebMediaPlayerClient* client) { | 3491 WebMediaPlayerClient* client) { |
| 3497 #if defined(ENABLE_WEBRTC) | 3492 #if defined(ENABLE_WEBRTC) |
| 3498 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 3493 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 3499 bool found_neon = | 3494 bool found_neon = |
| 3500 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 3495 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3579 | 3574 |
| 3580 #if defined(ENABLE_BROWSER_CDMS) | 3575 #if defined(ENABLE_BROWSER_CDMS) |
| 3581 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3576 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
| 3582 if (!cdm_manager_) | 3577 if (!cdm_manager_) |
| 3583 cdm_manager_ = new RendererCdmManager(this); | 3578 cdm_manager_ = new RendererCdmManager(this); |
| 3584 return cdm_manager_; | 3579 return cdm_manager_; |
| 3585 } | 3580 } |
| 3586 #endif // defined(ENABLE_BROWSER_CDMS) | 3581 #endif // defined(ENABLE_BROWSER_CDMS) |
| 3587 | 3582 |
| 3588 } // namespace content | 3583 } // namespace content |
| OLD | NEW |