OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 #include "content/renderer/device_orientation_dispatcher.h" | 48 #include "content/renderer/device_orientation_dispatcher.h" |
49 #include "content/renderer/devtools_agent.h" | 49 #include "content/renderer/devtools_agent.h" |
50 #include "content/renderer/external_popup_menu.h" | 50 #include "content/renderer/external_popup_menu.h" |
51 #include "content/renderer/geolocation_dispatcher.h" | 51 #include "content/renderer/geolocation_dispatcher.h" |
52 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | 52 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" |
53 #include "content/renderer/intents_dispatcher.h" | 53 #include "content/renderer/intents_dispatcher.h" |
54 #include "content/renderer/java_bridge_dispatcher.h" | 54 #include "content/renderer/java_bridge_dispatcher.h" |
55 #include "content/renderer/load_progress_tracker.h" | 55 #include "content/renderer/load_progress_tracker.h" |
56 #include "content/renderer/media/audio_message_filter.h" | 56 #include "content/renderer/media/audio_message_filter.h" |
57 #include "content/renderer/media/audio_renderer_impl.h" | 57 #include "content/renderer/media/audio_renderer_impl.h" |
58 #include "content/renderer/media/media_stream_dependency_factory.h" | |
59 #include "content/renderer/media/media_stream_dispatcher.h" | |
58 #include "content/renderer/media/media_stream_impl.h" | 60 #include "content/renderer/media/media_stream_impl.h" |
59 #include "content/renderer/media/render_media_log.h" | 61 #include "content/renderer/media/render_media_log.h" |
60 #include "content/renderer/mhtml_generator.h" | 62 #include "content/renderer/mhtml_generator.h" |
61 #include "content/renderer/notification_provider.h" | 63 #include "content/renderer/notification_provider.h" |
62 #include "content/renderer/p2p/socket_dispatcher.h" | 64 #include "content/renderer/p2p/socket_dispatcher.h" |
63 #include "content/renderer/plugin_channel_host.h" | 65 #include "content/renderer/plugin_channel_host.h" |
64 #include "content/renderer/render_process.h" | 66 #include "content/renderer/render_process.h" |
65 #include "content/renderer/render_thread_impl.h" | 67 #include "content/renderer/render_thread_impl.h" |
66 #include "content/renderer/render_widget_fullscreen_pepper.h" | 68 #include "content/renderer/render_widget_fullscreen_pepper.h" |
67 #include "content/renderer/renderer_accessibility.h" | 69 #include "content/renderer/renderer_accessibility.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" | 97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" |
96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" | 99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" |
98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h" | 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h" |
101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" | 103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" |
102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" | 104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" |
105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPeerConnectionHand ler.h" | |
106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPeerConnectionHand lerClient.h" | |
103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" | 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" |
106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" | 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" |
108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData .h" | 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData .h" |
112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 cached_has_main_frame_horizontal_scrollbar_(false), | 338 cached_has_main_frame_horizontal_scrollbar_(false), |
335 cached_has_main_frame_vertical_scrollbar_(false), | 339 cached_has_main_frame_vertical_scrollbar_(false), |
336 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 340 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
337 #if defined(OS_WIN) | 341 #if defined(OS_WIN) |
338 focused_plugin_id_(-1), | 342 focused_plugin_id_(-1), |
339 #endif | 343 #endif |
340 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 344 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
341 geolocation_dispatcher_(NULL), | 345 geolocation_dispatcher_(NULL), |
342 speech_input_dispatcher_(NULL), | 346 speech_input_dispatcher_(NULL), |
343 device_orientation_dispatcher_(NULL), | 347 device_orientation_dispatcher_(NULL), |
348 media_stream_dispatcher_(NULL), | |
344 p2p_socket_dispatcher_(NULL), | 349 p2p_socket_dispatcher_(NULL), |
345 devtools_agent_(NULL), | 350 devtools_agent_(NULL), |
346 renderer_accessibility_(NULL), | 351 renderer_accessibility_(NULL), |
347 session_storage_namespace_id_(session_storage_namespace_id), | 352 session_storage_namespace_id_(session_storage_namespace_id), |
348 handling_select_range_(false) { | 353 handling_select_range_(false) { |
349 routing_id_ = routing_id; | 354 routing_id_ = routing_id; |
350 if (opener_id != MSG_ROUTING_NONE) | 355 if (opener_id != MSG_ROUTING_NONE) |
351 opener_id_ = opener_id; | 356 opener_id_ = opener_id; |
352 | 357 |
353 webwidget_ = WebView::create(this); | 358 webwidget_ = WebView::create(this); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 webview()->mainFrame()->setName(frame_name); | 393 webview()->mainFrame()->setName(frame_name); |
389 webview()->settings()->setMinimumTimerInterval( | 394 webview()->settings()->setMinimumTimerInterval( |
390 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 395 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
391 webkit_glue::kForegroundTabTimerInterval); | 396 webkit_glue::kForegroundTabTimerInterval); |
392 | 397 |
393 OnSetRendererPrefs(renderer_prefs); | 398 OnSetRendererPrefs(renderer_prefs); |
394 | 399 |
395 host_window_ = parent_hwnd; | 400 host_window_ = parent_hwnd; |
396 | 401 |
397 #if defined(ENABLE_P2P_APIS) | 402 #if defined(ENABLE_P2P_APIS) |
398 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | 403 if (!p2p_socket_dispatcher_) |
404 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | |
399 #endif | 405 #endif |
400 | 406 |
401 new MHTMLGenerator(this); | 407 new MHTMLGenerator(this); |
402 #if defined(OS_MACOSX) | 408 #if defined(OS_MACOSX) |
403 new TextInputClientObserver(this); | 409 new TextInputClientObserver(this); |
404 #endif // defined(OS_MACOSX) | 410 #endif // defined(OS_MACOSX) |
405 | 411 |
406 devtools_agent_ = new DevToolsAgent(this); | 412 devtools_agent_ = new DevToolsAgent(this); |
407 | 413 |
408 renderer_accessibility_ = new RendererAccessibility(this); | 414 renderer_accessibility_ = new RendererAccessibility(this); |
409 | 415 |
410 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
411 if (command_line.HasSwitch(switches::kEnableMediaStream)) { | |
412 media_stream_impl_ = new MediaStreamImpl( | |
413 RenderThreadImpl::current()->video_capture_impl_manager()); | |
414 } | |
415 | |
416 content::GetContentClient()->renderer()->RenderViewCreated(this); | 416 content::GetContentClient()->renderer()->RenderViewCreated(this); |
417 } | 417 } |
418 | 418 |
419 RenderViewImpl::~RenderViewImpl() { | 419 RenderViewImpl::~RenderViewImpl() { |
420 history_page_ids_.clear(); | 420 history_page_ids_.clear(); |
421 | 421 |
422 if (decrement_shared_popup_at_destruction_) | 422 if (decrement_shared_popup_at_destruction_) |
423 shared_popup_counter_->data--; | 423 shared_popup_counter_->data--; |
424 | 424 |
425 // If file chooser is still waiting for answer, dispatch empty answer. | 425 // If file chooser is still waiting for answer, dispatch empty answer. |
(...skipping 15 matching lines...) Expand all Loading... | |
441 } | 441 } |
442 #endif | 442 #endif |
443 | 443 |
444 #ifndef NDEBUG | 444 #ifndef NDEBUG |
445 // Make sure we are no longer referenced by the ViewMap. | 445 // Make sure we are no longer referenced by the ViewMap. |
446 ViewMap* views = g_view_map.Pointer(); | 446 ViewMap* views = g_view_map.Pointer(); |
447 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) | 447 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) |
448 DCHECK_NE(this, it->second) << "Failed to call Close?"; | 448 DCHECK_NE(this, it->second) << "Failed to call Close?"; |
449 #endif | 449 #endif |
450 | 450 |
451 // MediaStreamImpl holds weak references to RenderViewObserver objects, | |
452 // ensure it's deleted before the observers. | |
453 media_stream_impl_ = NULL; | |
454 | |
451 FOR_EACH_OBSERVER(RenderViewObserver, observers_, RenderViewGone()); | 455 FOR_EACH_OBSERVER(RenderViewObserver, observers_, RenderViewGone()); |
452 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnDestruct()); | 456 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnDestruct()); |
453 } | 457 } |
454 | 458 |
455 /*static*/ | 459 /*static*/ |
456 RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { | 460 RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { |
457 ViewMap* views = g_view_map.Pointer(); | 461 ViewMap* views = g_view_map.Pointer(); |
458 ViewMap::iterator it = views->find(webview); | 462 ViewMap::iterator it = views->find(webview); |
459 return it == views->end() ? NULL : it->second; | 463 return it == views->end() ? NULL : it->second; |
460 } | 464 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 | 502 |
499 // static | 503 // static |
500 void RenderViewImpl::SetNextPageID(int32 next_page_id) { | 504 void RenderViewImpl::SetNextPageID(int32 next_page_id) { |
501 // This method should only be called during process startup, and the given | 505 // This method should only be called during process startup, and the given |
502 // page id had better not exceed our current next page id! | 506 // page id had better not exceed our current next page id! |
503 DCHECK_EQ(next_page_id_, 1); | 507 DCHECK_EQ(next_page_id_, 1); |
504 DCHECK(next_page_id >= next_page_id_); | 508 DCHECK(next_page_id >= next_page_id_); |
505 next_page_id_ = next_page_id; | 509 next_page_id_ = next_page_id; |
506 } | 510 } |
507 | 511 |
512 WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( | |
513 WebKit::WebPeerConnectionHandlerClient* client) { | |
514 // TODO(grunell): Should be under media-stream flag here. | |
tommi (sloooow) - chröme
2011/11/09 10:45:48
Are you going to check that flag before checkin?
Henrik Grunell
2011/11/09 20:36:04
Yes, I added the check. Thanks.
| |
515 #if defined(ENABLE_P2P_APIS) | |
516 if (!p2p_socket_dispatcher_) | |
517 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | |
518 #endif | |
519 | |
520 if (!media_stream_dispatcher_) | |
521 media_stream_dispatcher_ = new MediaStreamDispatcher(this); | |
522 | |
523 if (!media_stream_impl_.get()) { | |
524 MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory(); | |
525 media_stream_impl_ = new MediaStreamImpl( | |
526 media_stream_dispatcher_, | |
527 p2p_socket_dispatcher_, | |
528 RenderThreadImpl::current()->video_capture_impl_manager(), | |
529 factory); | |
530 } | |
531 return media_stream_impl_->CreatePeerConnectionHandler(client); | |
532 } | |
533 | |
508 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { | 534 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { |
509 observers_.AddObserver(observer); | 535 observers_.AddObserver(observer); |
510 } | 536 } |
511 | 537 |
512 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { | 538 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { |
513 observer->RenderViewGone(); | 539 observer->RenderViewGone(); |
514 observers_.RemoveObserver(observer); | 540 observers_.RemoveObserver(observer); |
515 } | 541 } |
516 | 542 |
517 WebKit::WebView* RenderViewImpl::webview() const { | 543 WebKit::WebView* RenderViewImpl::webview() const { |
(...skipping 4186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4704 return webview()->settings()->useThreadedCompositor(); | 4730 return webview()->settings()->useThreadedCompositor(); |
4705 } | 4731 } |
4706 | 4732 |
4707 void RenderViewImpl::OnJavaBridgeInit( | 4733 void RenderViewImpl::OnJavaBridgeInit( |
4708 const IPC::ChannelHandle& channel_handle) { | 4734 const IPC::ChannelHandle& channel_handle) { |
4709 DCHECK(!java_bridge_dispatcher_.get()); | 4735 DCHECK(!java_bridge_dispatcher_.get()); |
4710 #if defined(ENABLE_JAVA_BRIDGE) | 4736 #if defined(ENABLE_JAVA_BRIDGE) |
4711 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4737 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4712 #endif | 4738 #endif |
4713 } | 4739 } |
OLD | NEW |