| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
| 17 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
| 18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/process_util.h" | 21 #include "base/process_util.h" |
| 21 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 22 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
| 23 #include "base/string_split.h" | 24 #include "base/string_split.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
| 48 #include "content/public/common/context_menu_params.h" | 49 #include "content/public/common/context_menu_params.h" |
| 49 #include "content/public/common/file_chooser_params.h" | 50 #include "content/public/common/file_chooser_params.h" |
| 50 #include "content/public/common/selected_file_info.h" | 51 #include "content/public/common/selected_file_info.h" |
| 51 #include "content/public/common/url_constants.h" | 52 #include "content/public/common/url_constants.h" |
| 52 #include "content/public/renderer/content_renderer_client.h" | 53 #include "content/public/renderer/content_renderer_client.h" |
| 53 #include "content/public/renderer/document_state.h" | 54 #include "content/public/renderer/document_state.h" |
| 54 #include "content/public/renderer/navigation_state.h" | 55 #include "content/public/renderer/navigation_state.h" |
| 55 #include "content/public/renderer/render_view_observer.h" | 56 #include "content/public/renderer/render_view_observer.h" |
| 56 #include "content/public/renderer/render_view_visitor.h" | 57 #include "content/public/renderer/render_view_visitor.h" |
| 58 #include "content/renderer/browser_plugin/guest_to_embedder_channel.h" |
| 57 #include "content/renderer/device_orientation_dispatcher.h" | 59 #include "content/renderer/device_orientation_dispatcher.h" |
| 58 #include "content/renderer/devtools_agent.h" | 60 #include "content/renderer/devtools_agent.h" |
| 59 #include "content/renderer/dom_automation_controller.h" | 61 #include "content/renderer/dom_automation_controller.h" |
| 60 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 62 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 61 #include "content/renderer/external_popup_menu.h" | 63 #include "content/renderer/external_popup_menu.h" |
| 62 #include "content/renderer/geolocation_dispatcher.h" | 64 #include "content/renderer/geolocation_dispatcher.h" |
| 63 #include "content/renderer/gpu/compositor_thread.h" | 65 #include "content/renderer/gpu/compositor_thread.h" |
| 64 #include "content/renderer/idle_user_detector.h" | 66 #include "content/renderer/idle_user_detector.h" |
| 65 #include "content/renderer/input_tag_speech_dispatcher.h" | 67 #include "content/renderer/input_tag_speech_dispatcher.h" |
| 66 #include "content/renderer/java/java_bridge_dispatcher.h" | 68 #include "content/renderer/java/java_bridge_dispatcher.h" |
| 67 #include "content/renderer/load_progress_tracker.h" | 69 #include "content/renderer/load_progress_tracker.h" |
| 68 #include "content/renderer/media/audio_message_filter.h" | 70 #include "content/renderer/media/audio_message_filter.h" |
| 69 #include "content/renderer/media/media_stream_dependency_factory.h" | 71 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 70 #include "content/renderer/media/media_stream_dispatcher.h" | 72 #include "content/renderer/media/media_stream_dispatcher.h" |
| 71 #include "content/renderer/media/media_stream_impl.h" | 73 #include "content/renderer/media/media_stream_impl.h" |
| 72 #include "content/renderer/media/render_audiosourceprovider.h" | 74 #include "content/renderer/media/render_audiosourceprovider.h" |
| 73 #include "content/renderer/media/render_media_log.h" | 75 #include "content/renderer/media/render_media_log.h" |
| 74 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 76 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" |
| 75 #include "content/renderer/mhtml_generator.h" | 77 #include "content/renderer/mhtml_generator.h" |
| 76 #include "content/renderer/mouse_lock_dispatcher.h" | 78 #include "content/renderer/mouse_lock_dispatcher.h" |
| 77 #include "content/renderer/notification_provider.h" | 79 #include "content/renderer/notification_provider.h" |
| 78 #include "content/renderer/p2p/socket_dispatcher.h" | 80 #include "content/renderer/p2p/socket_dispatcher.h" |
| 79 #include "content/renderer/plugin_channel_host.h" | 81 #include "content/renderer/plugin_channel_host.h" |
| 82 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 80 #include "content/renderer/browser_plugin/browser_plugin_constants.h" | 83 #include "content/renderer/browser_plugin/browser_plugin_constants.h" |
| 81 #include "content/renderer/browser_plugin/browser_plugin_placeholder.h" | |
| 82 #include "content/renderer/render_process.h" | 84 #include "content/renderer/render_process.h" |
| 83 #include "content/renderer/render_thread_impl.h" | 85 #include "content/renderer/render_thread_impl.h" |
| 84 #include "content/renderer/render_widget_fullscreen_pepper.h" | 86 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 85 #include "content/renderer/renderer_accessibility.h" | 87 #include "content/renderer/renderer_accessibility.h" |
| 86 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 88 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 87 #include "content/renderer/renderer_webcolorchooser_impl.h" | 89 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 88 #include "content/renderer/text_input_client_observer.h" | 90 #include "content/renderer/text_input_client_observer.h" |
| 89 #include "content/renderer/v8_value_converter_impl.h" | 91 #include "content/renderer/v8_value_converter_impl.h" |
| 90 #include "content/renderer/web_intents_host.h" | 92 #include "content/renderer/web_intents_host.h" |
| 91 #include "content/renderer/web_ui_bindings.h" | 93 #include "content/renderer/web_ui_bindings.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 const WebPreferences& webkit_prefs, | 437 const WebPreferences& webkit_prefs, |
| 436 SharedRenderViewCounter* counter, | 438 SharedRenderViewCounter* counter, |
| 437 int32 routing_id, | 439 int32 routing_id, |
| 438 int32 surface_id, | 440 int32 surface_id, |
| 439 int64 session_storage_namespace_id, | 441 int64 session_storage_namespace_id, |
| 440 const string16& frame_name, | 442 const string16& frame_name, |
| 441 bool is_renderer_created, | 443 bool is_renderer_created, |
| 442 bool swapped_out, | 444 bool swapped_out, |
| 443 int32 next_page_id, | 445 int32 next_page_id, |
| 444 const WebKit::WebScreenInfo& screen_info, | 446 const WebKit::WebScreenInfo& screen_info, |
| 445 bool guest, | 447 content::GuestToEmbedderChannel* guest_to_embedder_channel, |
| 446 AccessibilityMode accessibility_mode) | 448 AccessibilityMode accessibility_mode) |
| 447 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), | 449 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), |
| 448 webkit_preferences_(webkit_prefs), | 450 webkit_preferences_(webkit_prefs), |
| 449 send_content_state_immediately_(false), | 451 send_content_state_immediately_(false), |
| 450 enabled_bindings_(0), | 452 enabled_bindings_(0), |
| 451 send_preferred_size_changes_(false), | 453 send_preferred_size_changes_(false), |
| 452 is_loading_(false), | 454 is_loading_(false), |
| 453 navigation_gesture_(NavigationGestureUnknown), | 455 navigation_gesture_(NavigationGestureUnknown), |
| 454 opened_by_user_gesture_(true), | 456 opened_by_user_gesture_(true), |
| 455 opener_suppressed_(false), | 457 opener_suppressed_(false), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 475 media_stream_impl_(NULL), | 477 media_stream_impl_(NULL), |
| 476 p2p_socket_dispatcher_(NULL), | 478 p2p_socket_dispatcher_(NULL), |
| 477 devtools_agent_(NULL), | 479 devtools_agent_(NULL), |
| 478 renderer_accessibility_(NULL), | 480 renderer_accessibility_(NULL), |
| 479 mouse_lock_dispatcher_(NULL), | 481 mouse_lock_dispatcher_(NULL), |
| 480 session_storage_namespace_id_(session_storage_namespace_id), | 482 session_storage_namespace_id_(session_storage_namespace_id), |
| 481 handling_select_range_(false), | 483 handling_select_range_(false), |
| 482 #if defined(OS_WIN) | 484 #if defined(OS_WIN) |
| 483 focused_plugin_id_(-1), | 485 focused_plugin_id_(-1), |
| 484 #endif | 486 #endif |
| 485 guest_(guest), | 487 guest_to_embedder_channel_(guest_to_embedder_channel), |
| 488 pp_instance_(0), |
| 489 uninitialized_context_(NULL), |
| 486 accessibility_mode_(accessibility_mode), | 490 accessibility_mode_(accessibility_mode), |
| 487 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 491 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { |
| 488 routing_id_ = routing_id; | 492 routing_id_ = routing_id; |
| 489 surface_id_ = surface_id; | 493 surface_id_ = surface_id; |
| 490 if (opener_id != MSG_ROUTING_NONE && is_renderer_created) | 494 if (opener_id != MSG_ROUTING_NONE && is_renderer_created) |
| 491 opener_id_ = opener_id; | 495 opener_id_ = opener_id; |
| 492 | 496 |
| 493 // Ensure we start with a valid next_page_id_ from the browser. | 497 // Ensure we start with a valid next_page_id_ from the browser. |
| 494 DCHECK_GE(next_page_id_, 0); | 498 DCHECK_GE(next_page_id_, 0); |
| 495 | 499 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 513 decrement_shared_popup_at_destruction_ = false; | 517 decrement_shared_popup_at_destruction_ = false; |
| 514 } | 518 } |
| 515 | 519 |
| 516 RenderThread::Get()->AddRoute(routing_id_, this); | 520 RenderThread::Get()->AddRoute(routing_id_, this); |
| 517 // Take a reference on behalf of the RenderThread. This will be balanced | 521 // Take a reference on behalf of the RenderThread. This will be balanced |
| 518 // when we receive ViewMsg_ClosePage. | 522 // when we receive ViewMsg_ClosePage. |
| 519 AddRef(); | 523 AddRef(); |
| 520 | 524 |
| 521 // If this is a popup, we must wait for the CreatingNew_ACK message before | 525 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 522 // completing initialization. Otherwise, we can finish it now. | 526 // completing initialization. Otherwise, we can finish it now. |
| 523 if (opener_id_ == MSG_ROUTING_NONE) { | 527 if (!guest_to_embedder_channel && opener_id_ == MSG_ROUTING_NONE) { |
| 524 did_show_ = true; | 528 did_show_ = true; |
| 525 CompleteInit(parent_hwnd); | 529 CompleteInit(parent_hwnd); |
| 526 } | 530 } |
| 527 | 531 |
| 528 g_view_map.Get().insert(std::make_pair(webview(), this)); | 532 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 529 webkit_preferences_.Apply(webview()); | 533 webkit_preferences_.Apply(webview()); |
| 534 |
| 530 webview()->initializeMainFrame(this); | 535 webview()->initializeMainFrame(this); |
| 531 if (!frame_name.empty()) | 536 if (!frame_name.empty()) |
| 532 webview()->mainFrame()->setName(frame_name); | 537 webview()->mainFrame()->setName(frame_name); |
| 533 webview()->settings()->setMinimumTimerInterval( | 538 webview()->settings()->setMinimumTimerInterval( |
| 534 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 539 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
| 535 webkit_glue::kForegroundTabTimerInterval); | 540 webkit_glue::kForegroundTabTimerInterval); |
| 536 | 541 |
| 537 OnSetRendererPrefs(renderer_prefs); | 542 OnSetRendererPrefs(renderer_prefs); |
| 538 | 543 |
| 539 host_window_ = parent_hwnd; | 544 host_window_ = parent_hwnd; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 const WebPreferences& webkit_prefs, | 656 const WebPreferences& webkit_prefs, |
| 652 SharedRenderViewCounter* counter, | 657 SharedRenderViewCounter* counter, |
| 653 int32 routing_id, | 658 int32 routing_id, |
| 654 int32 surface_id, | 659 int32 surface_id, |
| 655 int64 session_storage_namespace_id, | 660 int64 session_storage_namespace_id, |
| 656 const string16& frame_name, | 661 const string16& frame_name, |
| 657 bool is_renderer_created, | 662 bool is_renderer_created, |
| 658 bool swapped_out, | 663 bool swapped_out, |
| 659 int32 next_page_id, | 664 int32 next_page_id, |
| 660 const WebKit::WebScreenInfo& screen_info, | 665 const WebKit::WebScreenInfo& screen_info, |
| 661 bool guest, | 666 content::GuestToEmbedderChannel* guest_to_embedder_channel, |
| 662 AccessibilityMode accessibility_mode) { | 667 AccessibilityMode accessibility_mode) { |
| 663 DCHECK(routing_id != MSG_ROUTING_NONE); | 668 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 664 return new RenderViewImpl( | 669 return new RenderViewImpl( |
| 665 parent_hwnd, | 670 parent_hwnd, |
| 666 opener_id, | 671 opener_id, |
| 667 renderer_prefs, | 672 renderer_prefs, |
| 668 webkit_prefs, | 673 webkit_prefs, |
| 669 counter, | 674 counter, |
| 670 routing_id, | 675 routing_id, |
| 671 surface_id, | 676 surface_id, |
| 672 session_storage_namespace_id, | 677 session_storage_namespace_id, |
| 673 frame_name, | 678 frame_name, |
| 674 is_renderer_created, | 679 is_renderer_created, |
| 675 swapped_out, | 680 swapped_out, |
| 676 next_page_id, | 681 next_page_id, |
| 677 screen_info, | 682 screen_info, |
| 678 guest, | 683 guest_to_embedder_channel, |
| 679 accessibility_mode); | 684 accessibility_mode); |
| 680 } | 685 } |
| 681 | 686 |
| 682 WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( | 687 WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( |
| 683 WebPeerConnectionHandlerClient* client) { | 688 WebPeerConnectionHandlerClient* client) { |
| 684 EnsureMediaStreamImpl(); | 689 EnsureMediaStreamImpl(); |
| 685 if (!media_stream_impl_) | 690 if (!media_stream_impl_) |
| 686 return NULL; | 691 return NULL; |
| 687 return media_stream_impl_->CreatePeerConnectionHandler(client); | 692 return media_stream_impl_->CreatePeerConnectionHandler(client); |
| 688 } | 693 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 876 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 872 #endif | 877 #endif |
| 873 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 878 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 874 OnSetHistoryLengthAndPrune) | 879 OnSetHistoryLengthAndPrune) |
| 875 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 880 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 876 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 881 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
| 877 | 882 |
| 878 // Have the super handle all other messages. | 883 // Have the super handle all other messages. |
| 879 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 884 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 880 IPC_END_MESSAGE_MAP() | 885 IPC_END_MESSAGE_MAP() |
| 881 | |
| 882 if (!msg_is_ok) { | 886 if (!msg_is_ok) { |
| 883 // The message had a handler, but its deserialization failed. | 887 // The message had a handler, but its deserialization failed. |
| 884 // Kill the renderer to avoid potential spoofing attacks. | 888 // Kill the renderer to avoid potential spoofing attacks. |
| 885 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 889 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
| 886 } | 890 } |
| 887 | |
| 888 return handled; | 891 return handled; |
| 889 } | 892 } |
| 890 | 893 |
| 891 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { | 894 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| 892 MaybeHandleDebugURL(params.url); | 895 MaybeHandleDebugURL(params.url); |
| 893 if (!webview()) | 896 if (!webview()) |
| 894 return; | 897 return; |
| 895 | 898 |
| 896 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); | 899 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); |
| 897 | 900 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 webkit_preferences_, | 1538 webkit_preferences_, |
| 1536 shared_popup_counter_, | 1539 shared_popup_counter_, |
| 1537 routing_id, | 1540 routing_id, |
| 1538 surface_id, | 1541 surface_id, |
| 1539 cloned_session_storage_namespace_id, | 1542 cloned_session_storage_namespace_id, |
| 1540 frame_name, | 1543 frame_name, |
| 1541 true, | 1544 true, |
| 1542 false, | 1545 false, |
| 1543 1, | 1546 1, |
| 1544 screen_info_, | 1547 screen_info_, |
| 1545 guest_, | 1548 guest_to_embedder_channel_, |
| 1546 accessibility_mode_); | 1549 accessibility_mode_); |
| 1547 view->opened_by_user_gesture_ = params.user_gesture; | 1550 view->opened_by_user_gesture_ = params.user_gesture; |
| 1548 | 1551 |
| 1549 // Record whether the creator frame is trying to suppress the opener field. | 1552 // Record whether the creator frame is trying to suppress the opener field. |
| 1550 view->opener_suppressed_ = params.opener_suppressed; | 1553 view->opener_suppressed_ = params.opener_suppressed; |
| 1551 | 1554 |
| 1552 // Record the security origin of the creator. | 1555 // Record the security origin of the creator. |
| 1553 GURL creator_url(creator->document().securityOrigin().toString().utf8()); | 1556 GURL creator_url(creator->document().securityOrigin().toString().utf8()); |
| 1554 if (!creator_url.is_valid() || !creator_url.IsStandard()) | 1557 if (!creator_url.is_valid() || !creator_url.IsStandard()) |
| 1555 creator_url = GURL(); | 1558 creator_url = GURL(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 unsigned quota) { | 1603 unsigned quota) { |
| 1601 CHECK(session_storage_namespace_id_ != | 1604 CHECK(session_storage_namespace_id_ != |
| 1602 dom_storage::kInvalidSessionStorageNamespaceId); | 1605 dom_storage::kInvalidSessionStorageNamespaceId); |
| 1603 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1606 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
| 1604 } | 1607 } |
| 1605 | 1608 |
| 1606 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( | 1609 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( |
| 1607 const WebGraphicsContext3D::Attributes& attributes) { | 1610 const WebGraphicsContext3D::Attributes& attributes) { |
| 1608 if (!webview()) | 1611 if (!webview()) |
| 1609 return NULL; | 1612 return NULL; |
| 1613 |
| 1614 if (guest_to_embedder_channel()) { |
| 1615 WebGraphicsContext3DCommandBufferImpl* context = |
| 1616 guest_to_embedder_channel()->CreateWebGraphicsContext3D( |
| 1617 this, attributes, false); |
| 1618 if (!pp_instance()) { |
| 1619 uninitialized_context_ = context; |
| 1620 attributes_ = attributes; |
| 1621 } |
| 1622 return context; |
| 1623 } |
| 1624 |
| 1610 // The WebGraphicsContext3DInProcessImpl code path is used for | 1625 // The WebGraphicsContext3DInProcessImpl code path is used for |
| 1611 // layout tests (though not through this code) as well as for | 1626 // layout tests (though not through this code) as well as for |
| 1612 // debugging and bringing up new ports. | 1627 // debugging and bringing up new ports. |
| 1613 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { | 1628 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { |
| 1614 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( | 1629 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( |
| 1615 attributes, true); | 1630 attributes, true); |
| 1616 } else { | 1631 } else { |
| 1617 GURL url; | 1632 GURL url; |
| 1618 if (webview()->mainFrame()) | 1633 if (webview()->mainFrame()) |
| 1619 url = GURL(webview()->mainFrame()->document().url()); | 1634 url = GURL(webview()->mainFrame()->document().url()); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 compositor_thread->AddInputHandler( | 2137 compositor_thread->AddInputHandler( |
| 2123 routing_id_, input_handler_identifier, AsWeakPtr()); | 2138 routing_id_, input_handler_identifier, AsWeakPtr()); |
| 2124 | 2139 |
| 2125 RenderWidget::didActivateCompositor(input_handler_identifier); | 2140 RenderWidget::didActivateCompositor(input_handler_identifier); |
| 2126 } | 2141 } |
| 2127 | 2142 |
| 2128 // WebKit::WebFrameClient ----------------------------------------------------- | 2143 // WebKit::WebFrameClient ----------------------------------------------------- |
| 2129 | 2144 |
| 2130 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, | 2145 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, |
| 2131 const WebPluginParams& params) { | 2146 const WebPluginParams& params) { |
| 2132 // The browser plugin is a special kind of pepper plugin | |
| 2133 // that loads asynchronously. We first create a placeholder here. | |
| 2134 // When a guest is ready to be displayed, we swap out the placeholder | |
| 2135 // with the guest. | |
| 2136 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2147 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 2137 if (command_line.HasSwitch(switches::kEnableBrowserPlugin) && | 2148 if (command_line.HasSwitch(switches::kEnableBrowserPlugin) && |
| 2138 UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) | 2149 UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) |
| 2139 return BrowserPluginPlaceholder::Create(this, frame, params); | 2150 return BrowserPlugin::Create(this, frame, params); |
| 2140 | 2151 |
| 2141 WebPlugin* plugin = NULL; | 2152 WebPlugin* plugin = NULL; |
| 2142 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( | 2153 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( |
| 2143 this, frame, params, &plugin)) { | 2154 this, frame, params, &plugin)) { |
| 2144 return plugin; | 2155 return plugin; |
| 2145 } | 2156 } |
| 2146 | 2157 |
| 2147 webkit::WebPluginInfo info; | 2158 webkit::WebPluginInfo info; |
| 2148 std::string mime_type; | 2159 std::string mime_type; |
| 2149 bool found = GetPluginInfo(params.url, frame->top()->document().url(), | 2160 bool found = GetPluginInfo(params.url, frame->top()->document().url(), |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 if (node.isContentEditable()) { | 3609 if (node.isContentEditable()) { |
| 3599 is_editable_node = true; | 3610 is_editable_node = true; |
| 3600 } else if (node.isElementNode()) { | 3611 } else if (node.isElementNode()) { |
| 3601 is_editable_node = | 3612 is_editable_node = |
| 3602 node.toConst<WebElement>().isTextFormControlElement(); | 3613 node.toConst<WebElement>().isTextFormControlElement(); |
| 3603 } | 3614 } |
| 3604 } | 3615 } |
| 3605 return is_editable_node; | 3616 return is_editable_node; |
| 3606 } | 3617 } |
| 3607 | 3618 |
| 3619 void RenderViewImpl::GuestReady(PP_Instance instance) { |
| 3620 pp_instance_ = instance; |
| 3621 if (uninitialized_context_) { |
| 3622 bool success = guest_to_embedder_channel()->CreateGraphicsContext( |
| 3623 uninitialized_context_, |
| 3624 attributes_, |
| 3625 false, |
| 3626 this); |
| 3627 DCHECK(success); |
| 3628 } |
| 3629 CompleteInit(host_window_); |
| 3630 } |
| 3631 |
| 3632 webkit::ppapi::WebPluginImpl* RenderViewImpl::CreateBrowserPlugin( |
| 3633 const IPC::ChannelHandle& channel_handle, |
| 3634 int guest_process_id, |
| 3635 const WebKit::WebPluginParams& params) { |
| 3636 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
| 3637 pepper_delegate_.CreateBrowserPluginModule(channel_handle, |
| 3638 guest_process_id)); |
| 3639 return new webkit::ppapi::WebPluginImpl( |
| 3640 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); |
| 3641 } |
| 3642 |
| 3608 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( | 3643 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( |
| 3609 WebKit::WebFrame* frame, | 3644 WebKit::WebFrame* frame, |
| 3610 const webkit::WebPluginInfo& info, | 3645 const webkit::WebPluginInfo& info, |
| 3611 const WebKit::WebPluginParams& params) { | 3646 const WebKit::WebPluginParams& params) { |
| 3612 bool pepper_plugin_was_registered = false; | 3647 bool pepper_plugin_was_registered = false; |
| 3613 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 3648 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
| 3614 pepper_delegate_.CreatePepperPluginModule(info, | 3649 pepper_delegate_.CreatePepperPluginModule(info, |
| 3615 &pepper_plugin_was_registered)); | 3650 &pepper_plugin_was_registered)); |
| 3616 if (pepper_plugin_was_registered) { | 3651 if (pepper_plugin_was_registered) { |
| 3617 if (!pepper_module) | 3652 if (!pepper_module) |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4648 } | 4683 } |
| 4649 | 4684 |
| 4650 void RenderViewImpl::WillInitiatePaint() { | 4685 void RenderViewImpl::WillInitiatePaint() { |
| 4651 // Notify the pepper plugins that we're about to paint. | 4686 // Notify the pepper plugins that we're about to paint. |
| 4652 pepper_delegate_.ViewWillInitiatePaint(); | 4687 pepper_delegate_.ViewWillInitiatePaint(); |
| 4653 } | 4688 } |
| 4654 | 4689 |
| 4655 void RenderViewImpl::DidInitiatePaint() { | 4690 void RenderViewImpl::DidInitiatePaint() { |
| 4656 // Notify the pepper plugins that we've painted, and are waiting to flush. | 4691 // Notify the pepper plugins that we've painted, and are waiting to flush. |
| 4657 pepper_delegate_.ViewInitiatedPaint(); | 4692 pepper_delegate_.ViewInitiatedPaint(); |
| 4693 if (guest_to_embedder_channel()) |
| 4694 guest_to_embedder_channel()->IssueSwapBuffers(host_resource()); |
| 4658 } | 4695 } |
| 4659 | 4696 |
| 4660 void RenderViewImpl::DidFlushPaint() { | 4697 void RenderViewImpl::DidFlushPaint() { |
| 4661 // Notify any pepper plugins that we painted. This will call into the plugin, | 4698 // Notify any pepper plugins that we painted. This will call into the plugin, |
| 4662 // and we it may ask to close itself as a result. This will, in turn, modify | 4699 // and we it may ask to close itself as a result. This will, in turn, modify |
| 4663 // our set, possibly invalidating the iterator. So we iterate on a copy that | 4700 // our set, possibly invalidating the iterator. So we iterate on a copy that |
| 4664 // won't change out from under us. | 4701 // won't change out from under us. |
| 4665 pepper_delegate_.ViewFlushedPaint(); | 4702 pepper_delegate_.ViewFlushedPaint(); |
| 4666 | 4703 |
| 4667 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 4704 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5320 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5357 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5321 return !!RenderThreadImpl::current()->compositor_thread(); | 5358 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5322 } | 5359 } |
| 5323 | 5360 |
| 5324 void RenderViewImpl::OnJavaBridgeInit() { | 5361 void RenderViewImpl::OnJavaBridgeInit() { |
| 5325 DCHECK(!java_bridge_dispatcher_.get()); | 5362 DCHECK(!java_bridge_dispatcher_.get()); |
| 5326 #if defined(ENABLE_JAVA_BRIDGE) | 5363 #if defined(ENABLE_JAVA_BRIDGE) |
| 5327 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5364 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
| 5328 #endif | 5365 #endif |
| 5329 } | 5366 } |
| OLD | NEW |