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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 const WebPreferences& webkit_prefs, | 448 const WebPreferences& webkit_prefs, |
447 SharedRenderViewCounter* counter, | 449 SharedRenderViewCounter* counter, |
448 int32 routing_id, | 450 int32 routing_id, |
449 int32 surface_id, | 451 int32 surface_id, |
450 int64 session_storage_namespace_id, | 452 int64 session_storage_namespace_id, |
451 const string16& frame_name, | 453 const string16& frame_name, |
452 bool is_renderer_created, | 454 bool is_renderer_created, |
453 bool swapped_out, | 455 bool swapped_out, |
454 int32 next_page_id, | 456 int32 next_page_id, |
455 const WebKit::WebScreenInfo& screen_info, | 457 const WebKit::WebScreenInfo& screen_info, |
456 bool guest, | 458 content::GuestToEmbedderChannel* guest_to_embedder_channel, |
457 AccessibilityMode accessibility_mode) | 459 AccessibilityMode accessibility_mode) |
458 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), | 460 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), |
459 webkit_preferences_(webkit_prefs), | 461 webkit_preferences_(webkit_prefs), |
460 send_content_state_immediately_(false), | 462 send_content_state_immediately_(false), |
461 enabled_bindings_(0), | 463 enabled_bindings_(0), |
462 send_preferred_size_changes_(false), | 464 send_preferred_size_changes_(false), |
463 is_loading_(false), | 465 is_loading_(false), |
464 navigation_gesture_(NavigationGestureUnknown), | 466 navigation_gesture_(NavigationGestureUnknown), |
465 opened_by_user_gesture_(true), | 467 opened_by_user_gesture_(true), |
466 opener_suppressed_(false), | 468 opener_suppressed_(false), |
(...skipping 20 matching lines...) Expand all Loading... | |
487 p2p_socket_dispatcher_(NULL), | 489 p2p_socket_dispatcher_(NULL), |
488 devtools_agent_(NULL), | 490 devtools_agent_(NULL), |
489 renderer_accessibility_(NULL), | 491 renderer_accessibility_(NULL), |
490 java_bridge_dispatcher_(NULL), | 492 java_bridge_dispatcher_(NULL), |
491 mouse_lock_dispatcher_(NULL), | 493 mouse_lock_dispatcher_(NULL), |
492 session_storage_namespace_id_(session_storage_namespace_id), | 494 session_storage_namespace_id_(session_storage_namespace_id), |
493 handling_select_range_(false), | 495 handling_select_range_(false), |
494 #if defined(OS_WIN) | 496 #if defined(OS_WIN) |
495 focused_plugin_id_(-1), | 497 focused_plugin_id_(-1), |
496 #endif | 498 #endif |
497 guest_(guest), | 499 guest_to_embedder_channel_(guest_to_embedder_channel), |
500 pp_instance_(0), | |
501 uninitialized_context_(NULL), | |
498 accessibility_mode_(accessibility_mode), | 502 accessibility_mode_(accessibility_mode), |
499 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 503 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { |
500 routing_id_ = routing_id; | 504 routing_id_ = routing_id; |
501 surface_id_ = surface_id; | 505 surface_id_ = surface_id; |
502 if (opener_id != MSG_ROUTING_NONE && is_renderer_created) | 506 if (opener_id != MSG_ROUTING_NONE && is_renderer_created) |
503 opener_id_ = opener_id; | 507 opener_id_ = opener_id; |
504 | 508 |
505 // Ensure we start with a valid next_page_id_ from the browser. | 509 // Ensure we start with a valid next_page_id_ from the browser. |
506 DCHECK_GE(next_page_id_, 0); | 510 DCHECK_GE(next_page_id_, 0); |
507 | 511 |
(...skipping 17 matching lines...) Expand all Loading... | |
525 decrement_shared_popup_at_destruction_ = false; | 529 decrement_shared_popup_at_destruction_ = false; |
526 } | 530 } |
527 | 531 |
528 RenderThread::Get()->AddRoute(routing_id_, this); | 532 RenderThread::Get()->AddRoute(routing_id_, this); |
529 // Take a reference on behalf of the RenderThread. This will be balanced | 533 // Take a reference on behalf of the RenderThread. This will be balanced |
530 // when we receive ViewMsg_ClosePage. | 534 // when we receive ViewMsg_ClosePage. |
531 AddRef(); | 535 AddRef(); |
532 | 536 |
533 // If this is a popup, we must wait for the CreatingNew_ACK message before | 537 // If this is a popup, we must wait for the CreatingNew_ACK message before |
534 // completing initialization. Otherwise, we can finish it now. | 538 // completing initialization. Otherwise, we can finish it now. |
535 if (opener_id_ == MSG_ROUTING_NONE) { | 539 if (!guest_to_embedder_channel && opener_id_ == MSG_ROUTING_NONE) { |
536 did_show_ = true; | 540 did_show_ = true; |
537 CompleteInit(parent_hwnd); | 541 CompleteInit(parent_hwnd); |
538 } | 542 } |
539 | 543 |
540 g_view_map.Get().insert(std::make_pair(webview(), this)); | 544 g_view_map.Get().insert(std::make_pair(webview(), this)); |
541 webkit_preferences_.Apply(webview()); | 545 webkit_preferences_.Apply(webview()); |
546 | |
542 webview()->initializeMainFrame(this); | 547 webview()->initializeMainFrame(this); |
543 if (!frame_name.empty()) | 548 if (!frame_name.empty()) |
544 webview()->mainFrame()->setName(frame_name); | 549 webview()->mainFrame()->setName(frame_name); |
545 webview()->settings()->setMinimumTimerInterval( | 550 webview()->settings()->setMinimumTimerInterval( |
546 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 551 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
547 webkit_glue::kForegroundTabTimerInterval); | 552 webkit_glue::kForegroundTabTimerInterval); |
548 | 553 |
549 OnSetRendererPrefs(renderer_prefs); | 554 OnSetRendererPrefs(renderer_prefs); |
550 | 555 |
551 host_window_ = parent_hwnd; | 556 host_window_ = parent_hwnd; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
663 const WebPreferences& webkit_prefs, | 668 const WebPreferences& webkit_prefs, |
664 SharedRenderViewCounter* counter, | 669 SharedRenderViewCounter* counter, |
665 int32 routing_id, | 670 int32 routing_id, |
666 int32 surface_id, | 671 int32 surface_id, |
667 int64 session_storage_namespace_id, | 672 int64 session_storage_namespace_id, |
668 const string16& frame_name, | 673 const string16& frame_name, |
669 bool is_renderer_created, | 674 bool is_renderer_created, |
670 bool swapped_out, | 675 bool swapped_out, |
671 int32 next_page_id, | 676 int32 next_page_id, |
672 const WebKit::WebScreenInfo& screen_info, | 677 const WebKit::WebScreenInfo& screen_info, |
673 bool guest, | 678 content::GuestToEmbedderChannel* guest_to_embedder_channel, |
674 AccessibilityMode accessibility_mode) { | 679 AccessibilityMode accessibility_mode) { |
675 DCHECK(routing_id != MSG_ROUTING_NONE); | 680 DCHECK(routing_id != MSG_ROUTING_NONE); |
676 return new RenderViewImpl( | 681 return new RenderViewImpl( |
677 parent_hwnd, | 682 parent_hwnd, |
678 opener_id, | 683 opener_id, |
679 renderer_prefs, | 684 renderer_prefs, |
680 webkit_prefs, | 685 webkit_prefs, |
681 counter, | 686 counter, |
682 routing_id, | 687 routing_id, |
683 surface_id, | 688 surface_id, |
684 session_storage_namespace_id, | 689 session_storage_namespace_id, |
685 frame_name, | 690 frame_name, |
686 is_renderer_created, | 691 is_renderer_created, |
687 swapped_out, | 692 swapped_out, |
688 next_page_id, | 693 next_page_id, |
689 screen_info, | 694 screen_info, |
690 guest, | 695 guest_to_embedder_channel, |
691 accessibility_mode); | 696 accessibility_mode); |
692 } | 697 } |
693 | 698 |
694 WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( | 699 WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( |
695 WebPeerConnectionHandlerClient* client) { | 700 WebPeerConnectionHandlerClient* client) { |
696 EnsureMediaStreamImpl(); | 701 EnsureMediaStreamImpl(); |
697 if (!media_stream_impl_) | 702 if (!media_stream_impl_) |
698 return NULL; | 703 return NULL; |
699 return media_stream_impl_->CreatePeerConnectionHandler(client); | 704 return media_stream_impl_->CreatePeerConnectionHandler(client); |
700 } | 705 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 891 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
887 #endif | 892 #endif |
888 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 893 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
889 OnSetHistoryLengthAndPrune) | 894 OnSetHistoryLengthAndPrune) |
890 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 895 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
891 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 896 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
892 | 897 |
893 // Have the super handle all other messages. | 898 // Have the super handle all other messages. |
894 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 899 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
895 IPC_END_MESSAGE_MAP() | 900 IPC_END_MESSAGE_MAP() |
896 | |
jam
2012/05/16 02:22:40
why remove these blank lines?
Fady Samuel
2012/05/16 04:43:54
Restored.
| |
897 if (!msg_is_ok) { | 901 if (!msg_is_ok) { |
898 // The message had a handler, but its deserialization failed. | 902 // The message had a handler, but its deserialization failed. |
899 // Kill the renderer to avoid potential spoofing attacks. | 903 // Kill the renderer to avoid potential spoofing attacks. |
900 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 904 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
901 } | 905 } |
902 | |
903 return handled; | 906 return handled; |
904 } | 907 } |
905 | 908 |
906 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { | 909 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
907 MaybeHandleDebugURL(params.url); | 910 MaybeHandleDebugURL(params.url); |
908 if (!webview()) | 911 if (!webview()) |
909 return; | 912 return; |
910 | 913 |
911 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); | 914 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); |
912 | 915 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1550 webkit_preferences_, | 1553 webkit_preferences_, |
1551 shared_popup_counter_, | 1554 shared_popup_counter_, |
1552 routing_id, | 1555 routing_id, |
1553 surface_id, | 1556 surface_id, |
1554 cloned_session_storage_namespace_id, | 1557 cloned_session_storage_namespace_id, |
1555 frame_name, | 1558 frame_name, |
1556 true, | 1559 true, |
1557 false, | 1560 false, |
1558 1, | 1561 1, |
1559 screen_info_, | 1562 screen_info_, |
1560 guest_, | 1563 guest_to_embedder_channel_, |
1561 accessibility_mode_); | 1564 accessibility_mode_); |
1562 view->opened_by_user_gesture_ = params.user_gesture; | 1565 view->opened_by_user_gesture_ = params.user_gesture; |
1563 | 1566 |
1564 // Record whether the creator frame is trying to suppress the opener field. | 1567 // Record whether the creator frame is trying to suppress the opener field. |
1565 view->opener_suppressed_ = params.opener_suppressed; | 1568 view->opener_suppressed_ = params.opener_suppressed; |
1566 | 1569 |
1567 // Record the security origin of the creator. | 1570 // Record the security origin of the creator. |
1568 GURL creator_url(creator->document().securityOrigin().toString().utf8()); | 1571 GURL creator_url(creator->document().securityOrigin().toString().utf8()); |
1569 if (!creator_url.is_valid() || !creator_url.IsStandard()) | 1572 if (!creator_url.is_valid() || !creator_url.IsStandard()) |
1570 creator_url = GURL(); | 1573 creator_url = GURL(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1607 unsigned quota) { | 1610 unsigned quota) { |
1608 CHECK(session_storage_namespace_id_ != | 1611 CHECK(session_storage_namespace_id_ != |
1609 dom_storage::kInvalidSessionStorageNamespaceId); | 1612 dom_storage::kInvalidSessionStorageNamespaceId); |
1610 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1613 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
1611 } | 1614 } |
1612 | 1615 |
1613 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( | 1616 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( |
1614 const WebGraphicsContext3D::Attributes& attributes) { | 1617 const WebGraphicsContext3D::Attributes& attributes) { |
1615 if (!webview()) | 1618 if (!webview()) |
1616 return NULL; | 1619 return NULL; |
1620 | |
1621 if (guest_to_embedder_channel()) { | |
1622 WebGraphicsContext3DCommandBufferImpl* context = | |
1623 guest_to_embedder_channel()->CreateWebGraphicsContext3D( | |
1624 this, attributes, false); | |
1625 if (!pp_instance()) { | |
1626 uninitialized_context_ = context; | |
1627 attributes_ = attributes; | |
1628 } | |
1629 return context; | |
1630 } | |
1631 | |
1617 // The WebGraphicsContext3DInProcessImpl code path is used for | 1632 // The WebGraphicsContext3DInProcessImpl code path is used for |
1618 // layout tests (though not through this code) as well as for | 1633 // layout tests (though not through this code) as well as for |
1619 // debugging and bringing up new ports. | 1634 // debugging and bringing up new ports. |
1620 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { | 1635 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { |
1621 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( | 1636 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( |
1622 attributes, true); | 1637 attributes, true); |
1623 } else { | 1638 } else { |
1624 GURL url; | 1639 GURL url; |
1625 if (webview()->mainFrame()) | 1640 if (webview()->mainFrame()) |
1626 url = GURL(webview()->mainFrame()->document().url()); | 1641 url = GURL(webview()->mainFrame()->document().url()); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2129 compositor_thread->AddInputHandler( | 2144 compositor_thread->AddInputHandler( |
2130 routing_id_, input_handler_identifier, AsWeakPtr()); | 2145 routing_id_, input_handler_identifier, AsWeakPtr()); |
2131 | 2146 |
2132 RenderWidget::didActivateCompositor(input_handler_identifier); | 2147 RenderWidget::didActivateCompositor(input_handler_identifier); |
2133 } | 2148 } |
2134 | 2149 |
2135 // WebKit::WebFrameClient ----------------------------------------------------- | 2150 // WebKit::WebFrameClient ----------------------------------------------------- |
2136 | 2151 |
2137 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, | 2152 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, |
2138 const WebPluginParams& params) { | 2153 const WebPluginParams& params) { |
2139 // The browser plugin is a special kind of pepper plugin | |
2140 // that loads asynchronously. We first create a placeholder here. | |
2141 // When a guest is ready to be displayed, we swap out the placeholder | |
2142 // with the guest. | |
2143 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2154 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2144 if (command_line.HasSwitch(switches::kEnableBrowserPlugin) && | 2155 if (command_line.HasSwitch(switches::kEnableBrowserPlugin) && |
2145 UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) | 2156 UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) |
2146 return BrowserPluginPlaceholder::Create(this, frame, params); | 2157 return BrowserPlugin::Create(this, frame, params); |
2147 | 2158 |
2148 WebPlugin* plugin = NULL; | 2159 WebPlugin* plugin = NULL; |
2149 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( | 2160 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( |
2150 this, frame, params, &plugin)) { | 2161 this, frame, params, &plugin)) { |
2151 return plugin; | 2162 return plugin; |
2152 } | 2163 } |
2153 | 2164 |
2154 webkit::WebPluginInfo info; | 2165 webkit::WebPluginInfo info; |
2155 std::string mime_type; | 2166 std::string mime_type; |
2156 bool found = GetPluginInfo(params.url, frame->top()->document().url(), | 2167 bool found = GetPluginInfo(params.url, frame->top()->document().url(), |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3631 if (node.isContentEditable()) { | 3642 if (node.isContentEditable()) { |
3632 is_editable_node = true; | 3643 is_editable_node = true; |
3633 } else if (node.isElementNode()) { | 3644 } else if (node.isElementNode()) { |
3634 is_editable_node = | 3645 is_editable_node = |
3635 node.toConst<WebElement>().isTextFormControlElement(); | 3646 node.toConst<WebElement>().isTextFormControlElement(); |
3636 } | 3647 } |
3637 } | 3648 } |
3638 return is_editable_node; | 3649 return is_editable_node; |
3639 } | 3650 } |
3640 | 3651 |
3652 void RenderViewImpl::GuestReady(PP_Instance instance) { | |
3653 pp_instance_ = instance; | |
3654 if (uninitialized_context_) { | |
3655 bool success = guest_to_embedder_channel()->CreateGraphicsContext( | |
3656 uninitialized_context_, | |
3657 attributes_, | |
3658 false, | |
3659 this); | |
3660 DCHECK(success); | |
3661 } | |
3662 CompleteInit(host_window_); | |
3663 } | |
3664 | |
3665 webkit::ppapi::WebPluginImpl* RenderViewImpl::CreateBrowserPlugin( | |
3666 const IPC::ChannelHandle& channel_handle, | |
3667 int guest_process_id, | |
3668 const WebKit::WebPluginParams& params) { | |
3669 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | |
3670 pepper_delegate_.CreateBrowserPluginModule(channel_handle, | |
3671 guest_process_id)); | |
3672 return new webkit::ppapi::WebPluginImpl( | |
3673 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); | |
3674 } | |
3675 | |
3641 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( | 3676 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( |
3642 WebKit::WebFrame* frame, | 3677 WebKit::WebFrame* frame, |
3643 const webkit::WebPluginInfo& info, | 3678 const webkit::WebPluginInfo& info, |
3644 const WebKit::WebPluginParams& params) { | 3679 const WebKit::WebPluginParams& params) { |
3645 bool pepper_plugin_was_registered = false; | 3680 bool pepper_plugin_was_registered = false; |
3646 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 3681 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
3647 pepper_delegate_.CreatePepperPluginModule(info, | 3682 pepper_delegate_.CreatePepperPluginModule(info, |
3648 &pepper_plugin_was_registered)); | 3683 &pepper_plugin_was_registered)); |
3649 if (pepper_plugin_was_registered) { | 3684 if (pepper_plugin_was_registered) { |
3650 if (!pepper_module) | 3685 if (!pepper_module) |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4719 } | 4754 } |
4720 | 4755 |
4721 void RenderViewImpl::WillInitiatePaint() { | 4756 void RenderViewImpl::WillInitiatePaint() { |
4722 // Notify the pepper plugins that we're about to paint. | 4757 // Notify the pepper plugins that we're about to paint. |
4723 pepper_delegate_.ViewWillInitiatePaint(); | 4758 pepper_delegate_.ViewWillInitiatePaint(); |
4724 } | 4759 } |
4725 | 4760 |
4726 void RenderViewImpl::DidInitiatePaint() { | 4761 void RenderViewImpl::DidInitiatePaint() { |
4727 // Notify the pepper plugins that we've painted, and are waiting to flush. | 4762 // Notify the pepper plugins that we've painted, and are waiting to flush. |
4728 pepper_delegate_.ViewInitiatedPaint(); | 4763 pepper_delegate_.ViewInitiatedPaint(); |
4764 if (guest_to_embedder_channel()) | |
4765 guest_to_embedder_channel()->IssueSwapBuffers(host_resource()); | |
4729 } | 4766 } |
4730 | 4767 |
4731 void RenderViewImpl::DidFlushPaint() { | 4768 void RenderViewImpl::DidFlushPaint() { |
4732 // Notify any pepper plugins that we painted. This will call into the plugin, | 4769 // Notify any pepper plugins that we painted. This will call into the plugin, |
4733 // and we it may ask to close itself as a result. This will, in turn, modify | 4770 // and we it may ask to close itself as a result. This will, in turn, modify |
4734 // our set, possibly invalidating the iterator. So we iterate on a copy that | 4771 // our set, possibly invalidating the iterator. So we iterate on a copy that |
4735 // won't change out from under us. | 4772 // won't change out from under us. |
4736 pepper_delegate_.ViewFlushedPaint(); | 4773 pepper_delegate_.ViewFlushedPaint(); |
4737 | 4774 |
4738 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 4775 // 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... | |
5391 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5428 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5392 return !!RenderThreadImpl::current()->compositor_thread(); | 5429 return !!RenderThreadImpl::current()->compositor_thread(); |
5393 } | 5430 } |
5394 | 5431 |
5395 void RenderViewImpl::OnJavaBridgeInit() { | 5432 void RenderViewImpl::OnJavaBridgeInit() { |
5396 DCHECK(!java_bridge_dispatcher_); | 5433 DCHECK(!java_bridge_dispatcher_); |
5397 #if defined(ENABLE_JAVA_BRIDGE) | 5434 #if defined(ENABLE_JAVA_BRIDGE) |
5398 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5435 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5399 #endif | 5436 #endif |
5400 } | 5437 } |
OLD | NEW |