| 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 29 matching lines...) Expand all Loading... |
| 381 webview()->mainFrame()->setName(frame_name); | 384 webview()->mainFrame()->setName(frame_name); |
| 382 webview()->settings()->setMinimumTimerInterval( | 385 webview()->settings()->setMinimumTimerInterval( |
| 383 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 386 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
| 384 webkit_glue::kForegroundTabTimerInterval); | 387 webkit_glue::kForegroundTabTimerInterval); |
| 385 | 388 |
| 386 OnSetRendererPrefs(renderer_prefs); | 389 OnSetRendererPrefs(renderer_prefs); |
| 387 | 390 |
| 388 host_window_ = parent_hwnd; | 391 host_window_ = parent_hwnd; |
| 389 | 392 |
| 390 #if defined(ENABLE_P2P_APIS) | 393 #if defined(ENABLE_P2P_APIS) |
| 391 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | 394 if (!p2p_socket_dispatcher_) |
| 395 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
| 392 #endif | 396 #endif |
| 393 | 397 |
| 394 new MHTMLGenerator(this); | 398 new MHTMLGenerator(this); |
| 395 #if defined(OS_MACOSX) | 399 #if defined(OS_MACOSX) |
| 396 new TextInputClientObserver(this); | 400 new TextInputClientObserver(this); |
| 397 #endif // defined(OS_MACOSX) | 401 #endif // defined(OS_MACOSX) |
| 398 | 402 |
| 399 devtools_agent_ = new DevToolsAgent(this); | 403 devtools_agent_ = new DevToolsAgent(this); |
| 400 | 404 |
| 401 renderer_accessibility_ = new RendererAccessibility(this); | 405 renderer_accessibility_ = new RendererAccessibility(this); |
| 402 | 406 |
| 403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 404 if (command_line.HasSwitch(switches::kEnableMediaStream)) { | |
| 405 media_stream_impl_ = new MediaStreamImpl( | |
| 406 RenderThreadImpl::current()->video_capture_impl_manager()); | |
| 407 } | |
| 408 | |
| 409 content::GetContentClient()->renderer()->RenderViewCreated(this); | 407 content::GetContentClient()->renderer()->RenderViewCreated(this); |
| 410 } | 408 } |
| 411 | 409 |
| 412 RenderViewImpl::~RenderViewImpl() { | 410 RenderViewImpl::~RenderViewImpl() { |
| 413 history_page_ids_.clear(); | 411 history_page_ids_.clear(); |
| 414 | 412 |
| 415 if (decrement_shared_popup_at_destruction_) | 413 if (decrement_shared_popup_at_destruction_) |
| 416 shared_popup_counter_->data--; | 414 shared_popup_counter_->data--; |
| 417 | 415 |
| 418 // If file chooser is still waiting for answer, dispatch empty answer. | 416 // If file chooser is still waiting for answer, dispatch empty answer. |
| (...skipping 4025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4444 #endif | 4442 #endif |
| 4445 return speech_input_dispatcher_; | 4443 return speech_input_dispatcher_; |
| 4446 } | 4444 } |
| 4447 | 4445 |
| 4448 WebKit::WebDeviceOrientationClient* RenderViewImpl::deviceOrientationClient() { | 4446 WebKit::WebDeviceOrientationClient* RenderViewImpl::deviceOrientationClient() { |
| 4449 if (!device_orientation_dispatcher_) | 4447 if (!device_orientation_dispatcher_) |
| 4450 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); | 4448 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); |
| 4451 return device_orientation_dispatcher_; | 4449 return device_orientation_dispatcher_; |
| 4452 } | 4450 } |
| 4453 | 4451 |
| 4452 WebKit::WebMediaStreamClient* RenderView::mediaStreamClient() { |
| 4453 // TODO(grunell): Should be under media_stream flag here. |
| 4454 #if defined(ENABLE_P2P_APIS) |
| 4455 if (!p2p_socket_dispatcher_) |
| 4456 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
| 4457 #endif |
| 4458 |
| 4459 if (!media_stream_dispatcher_) |
| 4460 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
| 4461 |
| 4462 MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory(); |
| 4463 |
| 4464 if (!media_stream_impl_.get()) { |
| 4465 media_stream_impl_ = new MediaStreamImpl( |
| 4466 media_stream_dispatcher_, |
| 4467 p2p_socket_dispatcher_, |
| 4468 RenderThreadImpl::current()->video_capture_impl_manager(), |
| 4469 factory); |
| 4470 } |
| 4471 return media_stream_impl_.get(); |
| 4472 } |
| 4473 |
| 4474 |
| 4454 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 4475 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
| 4455 double maximum_level) { | 4476 double maximum_level) { |
| 4456 // For now, don't remember plugin zoom values. We don't want to mix them with | 4477 // For now, don't remember plugin zoom values. We don't want to mix them with |
| 4457 // normal web content (i.e. a fixed layout plugin would usually want them | 4478 // normal web content (i.e. a fixed layout plugin would usually want them |
| 4458 // different). | 4479 // different). |
| 4459 bool remember = !webview()->mainFrame()->document().isPluginDocument(); | 4480 bool remember = !webview()->mainFrame()->document().isPluginDocument(); |
| 4460 | 4481 |
| 4461 int minimum_percent = static_cast<int>( | 4482 int minimum_percent = static_cast<int>( |
| 4462 WebView::zoomLevelToZoomFactor(minimum_level) * 100); | 4483 WebView::zoomLevelToZoomFactor(minimum_level) * 100); |
| 4463 int maximum_percent = static_cast<int>( | 4484 int maximum_percent = static_cast<int>( |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4653 return webview()->settings()->useThreadedCompositor(); | 4674 return webview()->settings()->useThreadedCompositor(); |
| 4654 } | 4675 } |
| 4655 | 4676 |
| 4656 void RenderViewImpl::OnJavaBridgeInit( | 4677 void RenderViewImpl::OnJavaBridgeInit( |
| 4657 const IPC::ChannelHandle& channel_handle) { | 4678 const IPC::ChannelHandle& channel_handle) { |
| 4658 DCHECK(!java_bridge_dispatcher_.get()); | 4679 DCHECK(!java_bridge_dispatcher_.get()); |
| 4659 #if defined(ENABLE_JAVA_BRIDGE) | 4680 #if defined(ENABLE_JAVA_BRIDGE) |
| 4660 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4681 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
| 4661 #endif | 4682 #endif |
| 4662 } | 4683 } |
| OLD | NEW |