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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "content/renderer/device_orientation_dispatcher.h" | 49 #include "content/renderer/device_orientation_dispatcher.h" |
50 #include "content/renderer/devtools_agent.h" | 50 #include "content/renderer/devtools_agent.h" |
51 #include "content/renderer/external_popup_menu.h" | 51 #include "content/renderer/external_popup_menu.h" |
52 #include "content/renderer/geolocation_dispatcher.h" | 52 #include "content/renderer/geolocation_dispatcher.h" |
53 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | 53 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" |
54 #include "content/renderer/intents_dispatcher.h" | 54 #include "content/renderer/intents_dispatcher.h" |
55 #include "content/renderer/java_bridge_dispatcher.h" | 55 #include "content/renderer/java_bridge_dispatcher.h" |
56 #include "content/renderer/load_progress_tracker.h" | 56 #include "content/renderer/load_progress_tracker.h" |
57 #include "content/renderer/media/audio_message_filter.h" | 57 #include "content/renderer/media/audio_message_filter.h" |
58 #include "content/renderer/media/audio_renderer_impl.h" | 58 #include "content/renderer/media/audio_renderer_impl.h" |
| 59 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 60 #include "content/renderer/media/media_stream_dispatcher.h" |
59 #include "content/renderer/media/media_stream_impl.h" | 61 #include "content/renderer/media/media_stream_impl.h" |
60 #include "content/renderer/media/render_media_log.h" | 62 #include "content/renderer/media/render_media_log.h" |
61 #include "content/renderer/mhtml_generator.h" | 63 #include "content/renderer/mhtml_generator.h" |
62 #include "content/renderer/notification_provider.h" | 64 #include "content/renderer/notification_provider.h" |
63 #include "content/renderer/p2p/socket_dispatcher.h" | 65 #include "content/renderer/p2p/socket_dispatcher.h" |
64 #include "content/renderer/plugin_channel_host.h" | 66 #include "content/renderer/plugin_channel_host.h" |
65 #include "content/renderer/render_process.h" | 67 #include "content/renderer/render_process.h" |
66 #include "content/renderer/render_thread_impl.h" | 68 #include "content/renderer/render_thread_impl.h" |
67 #include "content/renderer/render_widget_fullscreen_pepper.h" | 69 #include "content/renderer/render_widget_fullscreen_pepper.h" |
68 #include "content/renderer/renderer_accessibility.h" | 70 #include "content/renderer/renderer_accessibility.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 cached_has_main_frame_horizontal_scrollbar_(false), | 334 cached_has_main_frame_horizontal_scrollbar_(false), |
333 cached_has_main_frame_vertical_scrollbar_(false), | 335 cached_has_main_frame_vertical_scrollbar_(false), |
334 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 336 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
335 #if defined(OS_WIN) | 337 #if defined(OS_WIN) |
336 focused_plugin_id_(-1), | 338 focused_plugin_id_(-1), |
337 #endif | 339 #endif |
338 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 340 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
339 geolocation_dispatcher_(NULL), | 341 geolocation_dispatcher_(NULL), |
340 speech_input_dispatcher_(NULL), | 342 speech_input_dispatcher_(NULL), |
341 device_orientation_dispatcher_(NULL), | 343 device_orientation_dispatcher_(NULL), |
| 344 media_stream_dispatcher_(NULL), |
342 p2p_socket_dispatcher_(NULL), | 345 p2p_socket_dispatcher_(NULL), |
343 devtools_agent_(NULL), | 346 devtools_agent_(NULL), |
344 renderer_accessibility_(NULL), | 347 renderer_accessibility_(NULL), |
345 session_storage_namespace_id_(session_storage_namespace_id), | 348 session_storage_namespace_id_(session_storage_namespace_id), |
346 handling_select_range_(false) { | 349 handling_select_range_(false) { |
347 routing_id_ = routing_id; | 350 routing_id_ = routing_id; |
348 if (opener_id != MSG_ROUTING_NONE) | 351 if (opener_id != MSG_ROUTING_NONE) |
349 opener_id_ = opener_id; | 352 opener_id_ = opener_id; |
350 | 353 |
351 webwidget_ = WebView::create(this); | 354 webwidget_ = WebView::create(this); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 webview()->mainFrame()->setName(frame_name); | 389 webview()->mainFrame()->setName(frame_name); |
387 webview()->settings()->setMinimumTimerInterval( | 390 webview()->settings()->setMinimumTimerInterval( |
388 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 391 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
389 webkit_glue::kForegroundTabTimerInterval); | 392 webkit_glue::kForegroundTabTimerInterval); |
390 | 393 |
391 OnSetRendererPrefs(renderer_prefs); | 394 OnSetRendererPrefs(renderer_prefs); |
392 | 395 |
393 host_window_ = parent_hwnd; | 396 host_window_ = parent_hwnd; |
394 | 397 |
395 #if defined(ENABLE_P2P_APIS) | 398 #if defined(ENABLE_P2P_APIS) |
396 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | 399 if (!p2p_socket_dispatcher_) |
| 400 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
397 #endif | 401 #endif |
398 | 402 |
399 new MHTMLGenerator(this); | 403 new MHTMLGenerator(this); |
400 #if defined(OS_MACOSX) | 404 #if defined(OS_MACOSX) |
401 new TextInputClientObserver(this); | 405 new TextInputClientObserver(this); |
402 #endif // defined(OS_MACOSX) | 406 #endif // defined(OS_MACOSX) |
403 | 407 |
404 devtools_agent_ = new DevToolsAgent(this); | 408 devtools_agent_ = new DevToolsAgent(this); |
405 | 409 |
406 renderer_accessibility_ = new RendererAccessibility(this); | 410 renderer_accessibility_ = new RendererAccessibility(this); |
407 | 411 |
408 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
409 if (command_line.HasSwitch(switches::kEnableMediaStream)) { | |
410 media_stream_impl_ = new MediaStreamImpl( | |
411 RenderThreadImpl::current()->video_capture_impl_manager()); | |
412 } | |
413 | |
414 content::GetContentClient()->renderer()->RenderViewCreated(this); | 412 content::GetContentClient()->renderer()->RenderViewCreated(this); |
415 } | 413 } |
416 | 414 |
417 RenderViewImpl::~RenderViewImpl() { | 415 RenderViewImpl::~RenderViewImpl() { |
418 history_page_ids_.clear(); | 416 history_page_ids_.clear(); |
419 | 417 |
420 if (decrement_shared_popup_at_destruction_) | 418 if (decrement_shared_popup_at_destruction_) |
421 shared_popup_counter_->data--; | 419 shared_popup_counter_->data--; |
422 | 420 |
423 // If file chooser is still waiting for answer, dispatch empty answer. | 421 // If file chooser is still waiting for answer, dispatch empty answer. |
(...skipping 4037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4461 #endif | 4459 #endif |
4462 return speech_input_dispatcher_; | 4460 return speech_input_dispatcher_; |
4463 } | 4461 } |
4464 | 4462 |
4465 WebKit::WebDeviceOrientationClient* RenderViewImpl::deviceOrientationClient() { | 4463 WebKit::WebDeviceOrientationClient* RenderViewImpl::deviceOrientationClient() { |
4466 if (!device_orientation_dispatcher_) | 4464 if (!device_orientation_dispatcher_) |
4467 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); | 4465 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); |
4468 return device_orientation_dispatcher_; | 4466 return device_orientation_dispatcher_; |
4469 } | 4467 } |
4470 | 4468 |
| 4469 WebKit::WebMediaStreamClient* RenderView::mediaStreamClient() { |
| 4470 // TODO(grunell): Should be under media_stream flag here. |
| 4471 #if defined(ENABLE_P2P_APIS) |
| 4472 if (!p2p_socket_dispatcher_) |
| 4473 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
| 4474 #endif |
| 4475 |
| 4476 if (!media_stream_dispatcher_) |
| 4477 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
| 4478 |
| 4479 MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory(); |
| 4480 |
| 4481 if (!media_stream_impl_.get()) { |
| 4482 media_stream_impl_ = new MediaStreamImpl( |
| 4483 media_stream_dispatcher_, |
| 4484 p2p_socket_dispatcher_, |
| 4485 RenderThreadImpl::current()->video_capture_impl_manager(), |
| 4486 factory); |
| 4487 } |
| 4488 return media_stream_impl_.get(); |
| 4489 } |
| 4490 |
| 4491 |
4471 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 4492 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
4472 double maximum_level) { | 4493 double maximum_level) { |
4473 // For now, don't remember plugin zoom values. We don't want to mix them with | 4494 // For now, don't remember plugin zoom values. We don't want to mix them with |
4474 // normal web content (i.e. a fixed layout plugin would usually want them | 4495 // normal web content (i.e. a fixed layout plugin would usually want them |
4475 // different). | 4496 // different). |
4476 bool remember = !webview()->mainFrame()->document().isPluginDocument(); | 4497 bool remember = !webview()->mainFrame()->document().isPluginDocument(); |
4477 | 4498 |
4478 int minimum_percent = static_cast<int>( | 4499 int minimum_percent = static_cast<int>( |
4479 WebView::zoomLevelToZoomFactor(minimum_level) * 100); | 4500 WebView::zoomLevelToZoomFactor(minimum_level) * 100); |
4480 int maximum_percent = static_cast<int>( | 4501 int maximum_percent = static_cast<int>( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4670 return webview()->settings()->useThreadedCompositor(); | 4691 return webview()->settings()->useThreadedCompositor(); |
4671 } | 4692 } |
4672 | 4693 |
4673 void RenderViewImpl::OnJavaBridgeInit( | 4694 void RenderViewImpl::OnJavaBridgeInit( |
4674 const IPC::ChannelHandle& channel_handle) { | 4695 const IPC::ChannelHandle& channel_handle) { |
4675 DCHECK(!java_bridge_dispatcher_.get()); | 4696 DCHECK(!java_bridge_dispatcher_.get()); |
4676 #if defined(ENABLE_JAVA_BRIDGE) | 4697 #if defined(ENABLE_JAVA_BRIDGE) |
4677 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4698 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4678 #endif | 4699 #endif |
4679 } | 4700 } |
OLD | NEW |