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/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" | 130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" |
131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" | 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" |
132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" | 132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" |
133 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" | 133 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" |
134 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 134 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
135 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 135 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
136 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 136 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
137 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData.
h" | 137 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData.
h" |
138 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" | 138 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
139 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" | 139 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" |
| 140 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ction00Handler.h" |
| 141 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ction00HandlerClient.h" |
140 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ctionHandler.h" | 142 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ctionHandler.h" |
141 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ctionHandlerClient.h" | 143 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ctionHandlerClient.h" |
142 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 144 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
143 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 145 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
144 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 146 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
145 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSocketStr
eamHandle.h" | 147 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSocketStr
eamHandle.h" |
146 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 148 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
147 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 149 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
148 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" | 150 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" |
149 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 151 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 using WebKit::WebIntentRequest; | 223 using WebKit::WebIntentRequest; |
222 using WebKit::WebIntentServiceInfo; | 224 using WebKit::WebIntentServiceInfo; |
223 using WebKit::WebMediaPlayer; | 225 using WebKit::WebMediaPlayer; |
224 using WebKit::WebMediaPlayerAction; | 226 using WebKit::WebMediaPlayerAction; |
225 using WebKit::WebMediaPlayerClient; | 227 using WebKit::WebMediaPlayerClient; |
226 using WebKit::WebNavigationPolicy; | 228 using WebKit::WebNavigationPolicy; |
227 using WebKit::WebNavigationType; | 229 using WebKit::WebNavigationType; |
228 using WebKit::WebNode; | 230 using WebKit::WebNode; |
229 using WebKit::WebPageSerializer; | 231 using WebKit::WebPageSerializer; |
230 using WebKit::WebPageSerializerClient; | 232 using WebKit::WebPageSerializerClient; |
| 233 using WebKit::WebPeerConnection00Handler; |
| 234 using WebKit::WebPeerConnection00HandlerClient; |
| 235 using WebKit::WebPeerConnectionHandler; |
| 236 using WebKit::WebPeerConnectionHandlerClient; |
231 using WebKit::WebPlugin; | 237 using WebKit::WebPlugin; |
232 using WebKit::WebPluginAction; | 238 using WebKit::WebPluginAction; |
233 using WebKit::WebPluginContainer; | 239 using WebKit::WebPluginContainer; |
234 using WebKit::WebPluginDocument; | 240 using WebKit::WebPluginDocument; |
235 using WebKit::WebPluginParams; | 241 using WebKit::WebPluginParams; |
236 using WebKit::WebPoint; | 242 using WebKit::WebPoint; |
237 using WebKit::WebPopupMenuInfo; | 243 using WebKit::WebPopupMenuInfo; |
238 using WebKit::WebRange; | 244 using WebKit::WebRange; |
239 using WebKit::WebRect; | 245 using WebKit::WebRect; |
240 using WebKit::WebReferrerPolicy; | 246 using WebKit::WebReferrerPolicy; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 counter, | 643 counter, |
638 routing_id, | 644 routing_id, |
639 surface_id, | 645 surface_id, |
640 session_storage_namespace_id, | 646 session_storage_namespace_id, |
641 frame_name, | 647 frame_name, |
642 next_page_id, | 648 next_page_id, |
643 screen_info, | 649 screen_info, |
644 guest); | 650 guest); |
645 } | 651 } |
646 | 652 |
647 WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( | 653 WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( |
648 WebKit::WebPeerConnectionHandlerClient* client) { | 654 WebPeerConnectionHandlerClient* client) { |
649 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
650 if (!cmd_line->HasSwitch(switches::kEnableMediaStream)) | |
651 return NULL; | |
652 EnsureMediaStreamImpl(); | 655 EnsureMediaStreamImpl(); |
653 if (!media_stream_impl_.get()) | 656 if (!media_stream_impl_.get()) |
654 return NULL; | 657 return NULL; |
655 return media_stream_impl_->CreatePeerConnectionHandler(client); | 658 return media_stream_impl_->CreatePeerConnectionHandler(client); |
656 } | 659 } |
657 | 660 |
| 661 WebPeerConnection00Handler* RenderViewImpl::CreatePeerConnectionHandlerJsep( |
| 662 WebPeerConnection00HandlerClient* client) { |
| 663 EnsureMediaStreamImpl(); |
| 664 if (!media_stream_impl_.get()) |
| 665 return NULL; |
| 666 return media_stream_impl_->CreatePeerConnectionHandlerJsep(client); |
| 667 } |
| 668 |
658 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { | 669 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { |
659 observers_.AddObserver(observer); | 670 observers_.AddObserver(observer); |
660 } | 671 } |
661 | 672 |
662 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { | 673 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { |
663 observer->RenderViewGone(); | 674 observer->RenderViewGone(); |
664 observers_.RemoveObserver(observer); | 675 observers_.RemoveObserver(observer); |
665 } | 676 } |
666 | 677 |
667 WebKit::WebView* RenderViewImpl::webview() const { | 678 WebKit::WebView* RenderViewImpl::webview() const { |
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 | 3280 |
3270 if (size == preferred_size_) | 3281 if (size == preferred_size_) |
3271 return; | 3282 return; |
3272 | 3283 |
3273 preferred_size_ = size; | 3284 preferred_size_ = size; |
3274 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 3285 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
3275 preferred_size_)); | 3286 preferred_size_)); |
3276 } | 3287 } |
3277 | 3288 |
3278 void RenderViewImpl::EnsureMediaStreamImpl() { | 3289 void RenderViewImpl::EnsureMediaStreamImpl() { |
| 3290 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 3291 if (!cmd_line->HasSwitch(switches::kEnableMediaStream)) |
| 3292 return; |
| 3293 |
3279 #if defined(ENABLE_P2P_APIS) | 3294 #if defined(ENABLE_P2P_APIS) |
3280 if (!p2p_socket_dispatcher_) | 3295 if (!p2p_socket_dispatcher_) |
3281 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | 3296 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
3282 #endif | 3297 #endif |
3283 | 3298 |
3284 #if defined(ENABLE_WEBRTC) | 3299 #if defined(ENABLE_WEBRTC) |
3285 if (!media_stream_dispatcher_) | 3300 if (!media_stream_dispatcher_) |
3286 media_stream_dispatcher_ = new MediaStreamDispatcher(this); | 3301 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
3287 | 3302 |
3288 if (!media_stream_impl_.get()) { | 3303 if (!media_stream_impl_.get()) { |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5137 WebKit::WebPageVisibilityStateVisible; | 5152 WebKit::WebPageVisibilityStateVisible; |
5138 WebKit::WebPageVisibilityState override_state = current_state; | 5153 WebKit::WebPageVisibilityState override_state = current_state; |
5139 if (content::GetContentClient()->renderer()-> | 5154 if (content::GetContentClient()->renderer()-> |
5140 ShouldOverridePageVisibilityState(this, | 5155 ShouldOverridePageVisibilityState(this, |
5141 &override_state)) | 5156 &override_state)) |
5142 return override_state; | 5157 return override_state; |
5143 return current_state; | 5158 return current_state; |
5144 } | 5159 } |
5145 | 5160 |
5146 WebKit::WebUserMediaClient* RenderViewImpl::userMediaClient() { | 5161 WebKit::WebUserMediaClient* RenderViewImpl::userMediaClient() { |
5147 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
5148 if (!cmd_line->HasSwitch(switches::kEnableMediaStream)) | |
5149 return NULL; | |
5150 EnsureMediaStreamImpl(); | 5162 EnsureMediaStreamImpl(); |
5151 return media_stream_impl_; | 5163 return media_stream_impl_; |
5152 } | 5164 } |
5153 | 5165 |
5154 bool RenderViewImpl::IsNonLocalTopLevelNavigation( | 5166 bool RenderViewImpl::IsNonLocalTopLevelNavigation( |
5155 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { | 5167 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { |
5156 // Must be a top level frame. | 5168 // Must be a top level frame. |
5157 if (frame->parent() != NULL) | 5169 if (frame->parent() != NULL) |
5158 return false; | 5170 return false; |
5159 | 5171 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5240 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5252 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5241 return !!RenderThreadImpl::current()->compositor_thread(); | 5253 return !!RenderThreadImpl::current()->compositor_thread(); |
5242 } | 5254 } |
5243 | 5255 |
5244 void RenderViewImpl::OnJavaBridgeInit() { | 5256 void RenderViewImpl::OnJavaBridgeInit() { |
5245 DCHECK(!java_bridge_dispatcher_.get()); | 5257 DCHECK(!java_bridge_dispatcher_.get()); |
5246 #if defined(ENABLE_JAVA_BRIDGE) | 5258 #if defined(ENABLE_JAVA_BRIDGE) |
5247 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5259 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
5248 #endif | 5260 #endif |
5249 } | 5261 } |
OLD | NEW |