| 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/public/renderer/render_view_visitor.h" | 48 #include "content/public/renderer/render_view_visitor.h" |
| 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/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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 cached_has_main_frame_horizontal_scrollbar_(false), | 333 cached_has_main_frame_horizontal_scrollbar_(false), |
| 332 cached_has_main_frame_vertical_scrollbar_(false), | 334 cached_has_main_frame_vertical_scrollbar_(false), |
| 333 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 335 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
| 334 #if defined(OS_WIN) | 336 #if defined(OS_WIN) |
| 335 focused_plugin_id_(-1), | 337 focused_plugin_id_(-1), |
| 336 #endif | 338 #endif |
| 337 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 339 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
| 338 geolocation_dispatcher_(NULL), | 340 geolocation_dispatcher_(NULL), |
| 339 speech_input_dispatcher_(NULL), | 341 speech_input_dispatcher_(NULL), |
| 340 device_orientation_dispatcher_(NULL), | 342 device_orientation_dispatcher_(NULL), |
| 343 media_stream_dispatcher_(NULL), |
| 341 p2p_socket_dispatcher_(NULL), | 344 p2p_socket_dispatcher_(NULL), |
| 342 devtools_agent_(NULL), | 345 devtools_agent_(NULL), |
| 343 renderer_accessibility_(NULL), | 346 renderer_accessibility_(NULL), |
| 344 session_storage_namespace_id_(session_storage_namespace_id), | 347 session_storage_namespace_id_(session_storage_namespace_id), |
| 345 handling_select_range_(false) { | 348 handling_select_range_(false) { |
| 346 routing_id_ = routing_id; | 349 routing_id_ = routing_id; |
| 347 if (opener_id != MSG_ROUTING_NONE) | 350 if (opener_id != MSG_ROUTING_NONE) |
| 348 opener_id_ = opener_id; | 351 opener_id_ = opener_id; |
| 349 | 352 |
| 350 webwidget_ = WebView::create(this); | 353 webwidget_ = WebView::create(this); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 380 webview()->mainFrame()->setName(frame_name); | 383 webview()->mainFrame()->setName(frame_name); |
| 381 webview()->settings()->setMinimumTimerInterval( | 384 webview()->settings()->setMinimumTimerInterval( |
| 382 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 385 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
| 383 webkit_glue::kForegroundTabTimerInterval); | 386 webkit_glue::kForegroundTabTimerInterval); |
| 384 | 387 |
| 385 OnSetRendererPrefs(renderer_prefs); | 388 OnSetRendererPrefs(renderer_prefs); |
| 386 | 389 |
| 387 host_window_ = parent_hwnd; | 390 host_window_ = parent_hwnd; |
| 388 | 391 |
| 389 #if defined(ENABLE_P2P_APIS) | 392 #if defined(ENABLE_P2P_APIS) |
| 390 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | 393 if (!p2p_socket_dispatcher_) |
| 394 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
| 391 #endif | 395 #endif |
| 392 | 396 |
| 393 new MHTMLGenerator(this); | 397 new MHTMLGenerator(this); |
| 394 #if defined(OS_MACOSX) | 398 #if defined(OS_MACOSX) |
| 395 new TextInputClientObserver(this); | 399 new TextInputClientObserver(this); |
| 396 #endif // defined(OS_MACOSX) | 400 #endif // defined(OS_MACOSX) |
| 397 | 401 |
| 398 devtools_agent_ = new DevToolsAgent(this); | 402 devtools_agent_ = new DevToolsAgent(this); |
| 399 | 403 |
| 400 renderer_accessibility_ = new RendererAccessibility(this); | 404 renderer_accessibility_ = new RendererAccessibility(this); |
| 401 | 405 |
| 402 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 403 if (command_line.HasSwitch(switches::kEnableMediaStream)) { | |
| 404 media_stream_impl_ = new MediaStreamImpl( | |
| 405 RenderThreadImpl::current()->video_capture_impl_manager()); | |
| 406 } | |
| 407 | |
| 408 content::GetContentClient()->renderer()->RenderViewCreated(this); | 406 content::GetContentClient()->renderer()->RenderViewCreated(this); |
| 409 } | 407 } |
| 410 | 408 |
| 411 RenderViewImpl::~RenderViewImpl() { | 409 RenderViewImpl::~RenderViewImpl() { |
| 412 history_page_ids_.clear(); | 410 history_page_ids_.clear(); |
| 413 | 411 |
| 414 if (decrement_shared_popup_at_destruction_) | 412 if (decrement_shared_popup_at_destruction_) |
| 415 shared_popup_counter_->data--; | 413 shared_popup_counter_->data--; |
| 416 | 414 |
| 417 // If file chooser is still waiting for answer, dispatch empty answer. | 415 // If file chooser is still waiting for answer, dispatch empty answer. |
| (...skipping 4000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4418 #endif | 4416 #endif |
| 4419 return speech_input_dispatcher_; | 4417 return speech_input_dispatcher_; |
| 4420 } | 4418 } |
| 4421 | 4419 |
| 4422 WebKit::WebDeviceOrientationClient* RenderViewImpl::deviceOrientationClient() { | 4420 WebKit::WebDeviceOrientationClient* RenderViewImpl::deviceOrientationClient() { |
| 4423 if (!device_orientation_dispatcher_) | 4421 if (!device_orientation_dispatcher_) |
| 4424 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); | 4422 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); |
| 4425 return device_orientation_dispatcher_; | 4423 return device_orientation_dispatcher_; |
| 4426 } | 4424 } |
| 4427 | 4425 |
| 4426 WebKit::WebMediaStreamClient* RenderViewImpl::mediaStreamClient() { |
| 4427 #if defined(ENABLE_P2P_APIS) |
| 4428 if (!p2p_socket_dispatcher_) |
| 4429 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
| 4430 #endif |
| 4431 |
| 4432 if (!media_stream_dispatcher_) |
| 4433 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
| 4434 |
| 4435 MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory(); |
| 4436 |
| 4437 if (!media_stream_impl_.get()) { |
| 4438 media_stream_impl_ = new MediaStreamImpl( |
| 4439 media_stream_dispatcher_, |
| 4440 p2p_socket_dispatcher_, |
| 4441 RenderThreadImpl::current()->video_capture_impl_manager(), |
| 4442 factory); |
| 4443 } |
| 4444 return media_stream_impl_.get(); |
| 4445 } |
| 4446 |
| 4447 |
| 4428 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 4448 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
| 4429 double maximum_level) { | 4449 double maximum_level) { |
| 4430 // For now, don't remember plugin zoom values. We don't want to mix them with | 4450 // For now, don't remember plugin zoom values. We don't want to mix them with |
| 4431 // normal web content (i.e. a fixed layout plugin would usually want them | 4451 // normal web content (i.e. a fixed layout plugin would usually want them |
| 4432 // different). | 4452 // different). |
| 4433 bool remember = !webview()->mainFrame()->document().isPluginDocument(); | 4453 bool remember = !webview()->mainFrame()->document().isPluginDocument(); |
| 4434 | 4454 |
| 4435 int minimum_percent = static_cast<int>( | 4455 int minimum_percent = static_cast<int>( |
| 4436 WebView::zoomLevelToZoomFactor(minimum_level) * 100); | 4456 WebView::zoomLevelToZoomFactor(minimum_level) * 100); |
| 4437 int maximum_percent = static_cast<int>( | 4457 int maximum_percent = static_cast<int>( |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4619 pepper_delegate_.OnLockMouseACK(succeeded); | 4639 pepper_delegate_.OnLockMouseACK(succeeded); |
| 4620 } | 4640 } |
| 4621 | 4641 |
| 4622 void RenderViewImpl::OnMouseLockLost() { | 4642 void RenderViewImpl::OnMouseLockLost() { |
| 4623 pepper_delegate_.OnMouseLockLost(); | 4643 pepper_delegate_.OnMouseLockLost(); |
| 4624 } | 4644 } |
| 4625 | 4645 |
| 4626 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4646 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 4627 return webview()->settings()->useThreadedCompositor(); | 4647 return webview()->settings()->useThreadedCompositor(); |
| 4628 } | 4648 } |
| OLD | NEW |