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