| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 // Mimics the order of events sent by WebKit. | 643 // Mimics the order of events sent by WebKit. |
| 644 // See WebCore::Editor::setComposition() for the corresponding code. | 644 // See WebCore::Editor::setComposition() for the corresponding code. |
| 645 render_view_->focused_pepper_plugin()->HandleCompositionEnd(last_text); | 645 render_view_->focused_pepper_plugin()->HandleCompositionEnd(last_text); |
| 646 render_view_->focused_pepper_plugin()->HandleTextInput(last_text); | 646 render_view_->focused_pepper_plugin()->HandleTextInput(last_text); |
| 647 } | 647 } |
| 648 pepper_composition_text_.clear(); | 648 pepper_composition_text_.clear(); |
| 649 } | 649 } |
| 650 | 650 |
| 651 #endif // ENABLE_PLUGINS | 651 #endif // ENABLE_PLUGINS |
| 652 | 652 |
| 653 MediaStreamDispatcher* RenderFrameImpl::GetMediaStreamDispatcher() { |
| 654 if (!web_user_media_client_) |
| 655 InitializeUserMediaClient(); |
| 656 return web_user_media_client_ ? |
| 657 web_user_media_client_->media_stream_dispatcher() : NULL; |
| 658 } |
| 659 |
| 653 bool RenderFrameImpl::Send(IPC::Message* message) { | 660 bool RenderFrameImpl::Send(IPC::Message* message) { |
| 654 if (is_detaching_) { | 661 if (is_detaching_) { |
| 655 delete message; | 662 delete message; |
| 656 return false; | 663 return false; |
| 657 } | 664 } |
| 658 if (is_swapped_out_ || render_view_->is_swapped_out()) { | 665 if (is_swapped_out_ || render_view_->is_swapped_out()) { |
| 659 if (!SwappedOutMessages::CanSendWhileSwappedOut(message)) { | 666 if (!SwappedOutMessages::CanSendWhileSwappedOut(message)) { |
| 660 delete message; | 667 delete message; |
| 661 return false; | 668 return false; |
| 662 } | 669 } |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 } | 1558 } |
| 1552 } | 1559 } |
| 1553 | 1560 |
| 1554 void RenderFrameImpl::frameFocused() { | 1561 void RenderFrameImpl::frameFocused() { |
| 1555 Send(new FrameHostMsg_FrameFocused(routing_id_)); | 1562 Send(new FrameHostMsg_FrameFocused(routing_id_)); |
| 1556 } | 1563 } |
| 1557 | 1564 |
| 1558 void RenderFrameImpl::willClose(blink::WebFrame* frame) { | 1565 void RenderFrameImpl::willClose(blink::WebFrame* frame) { |
| 1559 DCHECK(!frame_ || frame_ == frame); | 1566 DCHECK(!frame_ || frame_ == frame); |
| 1560 | 1567 |
| 1568 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose()); |
| 1561 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 1569 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 1562 FrameWillClose(frame)); | 1570 FrameWillClose(frame)); |
| 1563 } | 1571 } |
| 1564 | 1572 |
| 1565 void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame, | 1573 void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame, |
| 1566 const blink::WebString& name) { | 1574 const blink::WebString& name) { |
| 1567 DCHECK(!frame_ || frame_ == frame); | 1575 DCHECK(!frame_ || frame_ == frame); |
| 1568 if (!render_view_->renderer_preferences_.report_frame_name_changes) | 1576 if (!render_view_->renderer_preferences_.report_frame_name_changes) |
| 1569 return; | 1577 return; |
| 1570 | 1578 |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 void RenderFrameImpl::willStartUsingPeerConnectionHandler( | 2765 void RenderFrameImpl::willStartUsingPeerConnectionHandler( |
| 2758 blink::WebLocalFrame* frame, | 2766 blink::WebLocalFrame* frame, |
| 2759 blink::WebRTCPeerConnectionHandler* handler) { | 2767 blink::WebRTCPeerConnectionHandler* handler) { |
| 2760 DCHECK(!frame_ || frame_ == frame); | 2768 DCHECK(!frame_ || frame_ == frame); |
| 2761 #if defined(ENABLE_WEBRTC) | 2769 #if defined(ENABLE_WEBRTC) |
| 2762 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); | 2770 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); |
| 2763 #endif | 2771 #endif |
| 2764 } | 2772 } |
| 2765 | 2773 |
| 2766 blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() { | 2774 blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() { |
| 2767 // This can happen in tests, in which case it's OK to return NULL. | 2775 if (!web_user_media_client_) |
| 2768 if (!InitializeUserMediaClient()) | 2776 InitializeUserMediaClient(); |
| 2769 return NULL; | |
| 2770 | |
| 2771 return web_user_media_client_; | 2777 return web_user_media_client_; |
| 2772 } | 2778 } |
| 2773 | 2779 |
| 2774 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() { | 2780 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() { |
| 2775 if (!midi_dispatcher_) | 2781 if (!midi_dispatcher_) |
| 2776 midi_dispatcher_ = new MidiDispatcher(this); | 2782 midi_dispatcher_ = new MidiDispatcher(this); |
| 2777 return midi_dispatcher_; | 2783 return midi_dispatcher_; |
| 2778 } | 2784 } |
| 2779 | 2785 |
| 2780 bool RenderFrameImpl::willCheckAndDispatchMessageEvent( | 2786 bool RenderFrameImpl::willCheckAndDispatchMessageEvent( |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3443 selection_text_ = text; | 3449 selection_text_ = text; |
| 3444 selection_text_offset_ = offset; | 3450 selection_text_offset_ = offset; |
| 3445 selection_range_ = range; | 3451 selection_range_ = range; |
| 3446 // This IPC is dispatched by RenderWidetHost, so use its routing ID. | 3452 // This IPC is dispatched by RenderWidetHost, so use its routing ID. |
| 3447 Send(new ViewHostMsg_SelectionChanged( | 3453 Send(new ViewHostMsg_SelectionChanged( |
| 3448 GetRenderWidget()->routing_id(), text, offset, range)); | 3454 GetRenderWidget()->routing_id(), text, offset, range)); |
| 3449 } | 3455 } |
| 3450 GetRenderWidget()->UpdateSelectionBounds(); | 3456 GetRenderWidget()->UpdateSelectionBounds(); |
| 3451 } | 3457 } |
| 3452 | 3458 |
| 3453 bool RenderFrameImpl::InitializeUserMediaClient() { | 3459 void RenderFrameImpl::InitializeUserMediaClient() { |
| 3454 if (web_user_media_client_) | |
| 3455 return true; | |
| 3456 | |
| 3457 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. | 3460 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. |
| 3458 return false; | 3461 return; |
| 3459 | 3462 |
| 3460 #if defined(OS_ANDROID) | 3463 #if defined(OS_ANDROID) |
| 3461 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) | 3464 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) |
| 3462 return false; | 3465 return; |
| 3463 #endif | 3466 #endif |
| 3464 | 3467 |
| 3465 #if defined(ENABLE_WEBRTC) | 3468 #if defined(ENABLE_WEBRTC) |
| 3466 if (!render_view_->media_stream_dispatcher_) { | 3469 DCHECK(!web_user_media_client_); |
| 3467 render_view_->media_stream_dispatcher_ = | 3470 web_user_media_client_ = new MediaStreamImpl( |
| 3468 new MediaStreamDispatcher(render_view_.get()); | 3471 this, |
| 3469 } | 3472 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(), |
| 3470 | 3473 make_scoped_ptr(new MediaStreamDispatcher(this)).Pass()); |
| 3471 MediaStreamImpl* media_stream_impl = new MediaStreamImpl( | |
| 3472 render_view_.get(), | |
| 3473 render_view_->media_stream_dispatcher_, | |
| 3474 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()); | |
| 3475 web_user_media_client_ = media_stream_impl; | |
| 3476 return true; | |
| 3477 #else | |
| 3478 return false; | |
| 3479 #endif | 3474 #endif |
| 3480 } | 3475 } |
| 3481 | 3476 |
| 3482 WebMediaPlayer* RenderFrameImpl::CreateWebMediaPlayerForMediaStream( | 3477 WebMediaPlayer* RenderFrameImpl::CreateWebMediaPlayerForMediaStream( |
| 3483 const blink::WebURL& url, | 3478 const blink::WebURL& url, |
| 3484 WebMediaPlayerClient* client) { | 3479 WebMediaPlayerClient* client) { |
| 3485 #if defined(ENABLE_WEBRTC) | 3480 #if defined(ENABLE_WEBRTC) |
| 3486 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 3481 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 3487 bool found_neon = | 3482 bool found_neon = |
| 3488 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 3483 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3571 | 3566 |
| 3572 #if defined(ENABLE_BROWSER_CDMS) | 3567 #if defined(ENABLE_BROWSER_CDMS) |
| 3573 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3568 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
| 3574 if (!cdm_manager_) | 3569 if (!cdm_manager_) |
| 3575 cdm_manager_ = new RendererCdmManager(this); | 3570 cdm_manager_ = new RendererCdmManager(this); |
| 3576 return cdm_manager_; | 3571 return cdm_manager_; |
| 3577 } | 3572 } |
| 3578 #endif // defined(ENABLE_BROWSER_CDMS) | 3573 #endif // defined(ENABLE_BROWSER_CDMS) |
| 3579 | 3574 |
| 3580 } // namespace content | 3575 } // namespace content |
| OLD | NEW |