Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 9609008: Implemented Browser Plugin (NOT FOR REVIEW) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Initial plumbing of a guest flag to RenderViewImpl (cleaner than early prototype) Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "content/public/renderer/content_renderer_client.h" 48 #include "content/public/renderer/content_renderer_client.h"
49 #include "content/public/renderer/document_state.h" 49 #include "content/public/renderer/document_state.h"
50 #include "content/public/renderer/navigation_state.h" 50 #include "content/public/renderer/navigation_state.h"
51 #include "content/public/renderer/render_view_observer.h" 51 #include "content/public/renderer/render_view_observer.h"
52 #include "content/public/renderer/render_view_visitor.h" 52 #include "content/public/renderer/render_view_visitor.h"
53 #include "content/renderer/device_orientation_dispatcher.h" 53 #include "content/renderer/device_orientation_dispatcher.h"
54 #include "content/renderer/devtools_agent.h" 54 #include "content/renderer/devtools_agent.h"
55 #include "content/renderer/dom_automation_controller.h" 55 #include "content/renderer/dom_automation_controller.h"
56 #include "content/renderer/external_popup_menu.h" 56 #include "content/renderer/external_popup_menu.h"
57 #include "content/renderer/geolocation_dispatcher.h" 57 #include "content/renderer/geolocation_dispatcher.h"
58 #include "content/renderer/guest_render_view_observer.h"
58 #include "content/renderer/idle_user_detector.h" 59 #include "content/renderer/idle_user_detector.h"
59 #include "content/renderer/input_tag_speech_dispatcher.h" 60 #include "content/renderer/input_tag_speech_dispatcher.h"
60 #include "content/renderer/web_intents_host.h" 61 #include "content/renderer/web_intents_host.h"
61 #include "content/renderer/java/java_bridge_dispatcher.h" 62 #include "content/renderer/java/java_bridge_dispatcher.h"
62 #include "content/renderer/load_progress_tracker.h" 63 #include "content/renderer/load_progress_tracker.h"
63 #include "content/renderer/media/audio_message_filter.h" 64 #include "content/renderer/media/audio_message_filter.h"
64 #include "content/renderer/media/audio_renderer_impl.h" 65 #include "content/renderer/media/audio_renderer_impl.h"
65 #include "content/renderer/media/media_stream_dependency_factory.h" 66 #include "content/renderer/media/media_stream_dependency_factory.h"
66 #include "content/renderer/media/media_stream_dispatcher.h" 67 #include "content/renderer/media/media_stream_dispatcher.h"
67 #include "content/renderer/media/media_stream_impl.h" 68 #include "content/renderer/media/media_stream_impl.h"
68 #include "content/renderer/media/render_audiosourceprovider.h" 69 #include "content/renderer/media/render_audiosourceprovider.h"
69 #include "content/renderer/media/render_media_log.h" 70 #include "content/renderer/media/render_media_log.h"
70 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" 71 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
71 #include "content/renderer/mhtml_generator.h" 72 #include "content/renderer/mhtml_generator.h"
72 #include "content/renderer/mouse_lock_dispatcher.h" 73 #include "content/renderer/mouse_lock_dispatcher.h"
73 #include "content/renderer/notification_provider.h" 74 #include "content/renderer/notification_provider.h"
74 #include "content/renderer/p2p/socket_dispatcher.h" 75 #include "content/renderer/p2p/socket_dispatcher.h"
75 #include "content/renderer/plugin_channel_host.h" 76 #include "content/renderer/plugin_channel_host.h"
77 #include "content/renderer/plugins/browser_plugin_placeholder.h"
76 #include "content/renderer/render_process.h" 78 #include "content/renderer/render_process.h"
77 #include "content/renderer/render_thread_impl.h" 79 #include "content/renderer/render_thread_impl.h"
78 #include "content/renderer/render_widget_fullscreen_pepper.h" 80 #include "content/renderer/render_widget_fullscreen_pepper.h"
79 #include "content/renderer/renderer_accessibility.h" 81 #include "content/renderer/renderer_accessibility.h"
80 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 82 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
81 #include "content/renderer/renderer_webstoragenamespace_impl.h" 83 #include "content/renderer/renderer_webstoragenamespace_impl.h"
82 #include "content/renderer/text_input_client_observer.h" 84 #include "content/renderer/text_input_client_observer.h"
83 #include "content/renderer/v8_value_converter_impl.h" 85 #include "content/renderer/v8_value_converter_impl.h"
84 #include "content/renderer/web_ui_bindings.h" 86 #include "content/renderer/web_ui_bindings.h"
85 #include "content/renderer/webplugin_delegate_proxy.h" 87 #include "content/renderer/webplugin_delegate_proxy.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 #include "webkit/glue/webdropdata.h" 160 #include "webkit/glue/webdropdata.h"
159 #include "webkit/glue/webkit_constants.h" 161 #include "webkit/glue/webkit_constants.h"
160 #include "webkit/glue/webkit_glue.h" 162 #include "webkit/glue/webkit_glue.h"
161 #include "webkit/glue/weburlloader_impl.h" 163 #include "webkit/glue/weburlloader_impl.h"
162 #include "webkit/glue/weburlresponse_extradata_impl.h" 164 #include "webkit/glue/weburlresponse_extradata_impl.h"
163 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" 165 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
164 #include "webkit/media/webmediaplayer_impl.h" 166 #include "webkit/media/webmediaplayer_impl.h"
165 #include "webkit/plugins/npapi/plugin_list.h" 167 #include "webkit/plugins/npapi/plugin_list.h"
166 #include "webkit/plugins/npapi/webplugin_delegate.h" 168 #include "webkit/plugins/npapi/webplugin_delegate.h"
167 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 169 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
170 #include "webkit/plugins/plugin_constants.h"
168 #include "webkit/plugins/npapi/webplugin_impl.h" 171 #include "webkit/plugins/npapi/webplugin_impl.h"
169 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 172 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
170 173
171 #if defined(OS_WIN) 174 #if defined(OS_WIN)
172 // TODO(port): these files are currently Windows only because they concern: 175 // TODO(port): these files are currently Windows only because they concern:
173 // * theming 176 // * theming
174 #include "ui/gfx/native_theme_win.h" 177 #include "ui/gfx/native_theme_win.h"
175 #elif defined(USE_X11) 178 #elif defined(USE_X11)
176 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme. h" 179 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme. h"
177 #include "ui/gfx/native_theme.h" 180 #include "ui/gfx/native_theme.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 gfx::NativeViewId parent_hwnd, 415 gfx::NativeViewId parent_hwnd,
413 int32 opener_id, 416 int32 opener_id,
414 const content::RendererPreferences& renderer_prefs, 417 const content::RendererPreferences& renderer_prefs,
415 const WebPreferences& webkit_prefs, 418 const WebPreferences& webkit_prefs,
416 SharedRenderViewCounter* counter, 419 SharedRenderViewCounter* counter,
417 int32 routing_id, 420 int32 routing_id,
418 int32 surface_id, 421 int32 surface_id,
419 int64 session_storage_namespace_id, 422 int64 session_storage_namespace_id,
420 const string16& frame_name, 423 const string16& frame_name,
421 int32 next_page_id, 424 int32 next_page_id,
422 const WebKit::WebScreenInfo& screen_info) 425 const WebKit::WebScreenInfo& screen_info,
426 bool guest)
423 : RenderWidget(WebKit::WebPopupTypeNone, screen_info), 427 : RenderWidget(WebKit::WebPopupTypeNone, screen_info),
424 webkit_preferences_(webkit_prefs), 428 webkit_preferences_(webkit_prefs),
425 send_content_state_immediately_(false), 429 send_content_state_immediately_(false),
426 enabled_bindings_(0), 430 enabled_bindings_(0),
427 send_preferred_size_changes_(false), 431 send_preferred_size_changes_(false),
428 is_loading_(false), 432 is_loading_(false),
429 navigation_gesture_(NavigationGestureUnknown), 433 navigation_gesture_(NavigationGestureUnknown),
430 opened_by_user_gesture_(true), 434 opened_by_user_gesture_(true),
431 opener_suppressed_(false), 435 opener_suppressed_(false),
432 page_id_(-1), 436 page_id_(-1),
433 last_page_id_sent_to_browser_(-1), 437 last_page_id_sent_to_browser_(-1),
434 next_page_id_(next_page_id), 438 next_page_id_(next_page_id),
435 history_list_offset_(-1), 439 history_list_offset_(-1),
436 history_list_length_(0), 440 history_list_length_(0),
437 target_url_status_(TARGET_NONE), 441 target_url_status_(TARGET_NONE),
438 selection_text_offset_(0), 442 selection_text_offset_(0),
439 cached_is_main_frame_pinned_to_left_(false), 443 cached_is_main_frame_pinned_to_left_(false),
440 cached_is_main_frame_pinned_to_right_(false), 444 cached_is_main_frame_pinned_to_right_(false),
441 cached_has_main_frame_horizontal_scrollbar_(false), 445 cached_has_main_frame_horizontal_scrollbar_(false),
442 cached_has_main_frame_vertical_scrollbar_(false), 446 cached_has_main_frame_vertical_scrollbar_(false),
443 context_has_swapbuffers_complete_callback_(false), 447 context_has_swapbuffers_complete_callback_(false),
444 queried_for_swapbuffers_complete_callback_(false), 448 queried_for_swapbuffers_complete_callback_(false),
445 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), 449 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)),
446 geolocation_dispatcher_(NULL), 450 geolocation_dispatcher_(NULL),
451 guest_observer_(NULL),
447 input_tag_speech_dispatcher_(NULL), 452 input_tag_speech_dispatcher_(NULL),
448 device_orientation_dispatcher_(NULL), 453 device_orientation_dispatcher_(NULL),
449 media_stream_dispatcher_(NULL), 454 media_stream_dispatcher_(NULL),
450 p2p_socket_dispatcher_(NULL), 455 p2p_socket_dispatcher_(NULL),
451 devtools_agent_(NULL), 456 devtools_agent_(NULL),
452 renderer_accessibility_(NULL), 457 renderer_accessibility_(NULL),
453 mouse_lock_dispatcher_(NULL), 458 mouse_lock_dispatcher_(NULL),
454 session_storage_namespace_id_(session_storage_namespace_id), 459 session_storage_namespace_id_(session_storage_namespace_id),
455 handling_select_range_(false), 460 handling_select_range_(false),
456 #if defined(OS_WIN) 461 #if defined(OS_WIN)
457 focused_plugin_id_(-1), 462 focused_plugin_id_(-1),
458 #endif 463 #endif
464 guest_(guest),
459 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { 465 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) {
460 routing_id_ = routing_id; 466 routing_id_ = routing_id;
461 surface_id_ = surface_id; 467 surface_id_ = surface_id;
462 if (opener_id != MSG_ROUTING_NONE) 468 if (opener_id != MSG_ROUTING_NONE)
463 opener_id_ = opener_id; 469 opener_id_ = opener_id;
464 470
465 // Ensure we start with a valid next_page_id_ from the browser. 471 // Ensure we start with a valid next_page_id_ from the browser.
466 DCHECK_GE(next_page_id_, 0); 472 DCHECK_GE(next_page_id_, 0);
467 473
468 #if defined(ENABLE_NOTIFICATIONS) 474 #if defined(ENABLE_NOTIFICATIONS)
(...skipping 16 matching lines...) Expand all
485 491
486 RenderThread::Get()->AddRoute(routing_id_, this); 492 RenderThread::Get()->AddRoute(routing_id_, this);
487 // Take a reference on behalf of the RenderThread. This will be balanced 493 // Take a reference on behalf of the RenderThread. This will be balanced
488 // when we receive ViewMsg_ClosePage. 494 // when we receive ViewMsg_ClosePage.
489 AddRef(); 495 AddRef();
490 496
491 // If this is a popup, we must wait for the CreatingNew_ACK message before 497 // If this is a popup, we must wait for the CreatingNew_ACK message before
492 // completing initialization. Otherwise, we can finish it now. 498 // completing initialization. Otherwise, we can finish it now.
493 if (opener_id == MSG_ROUTING_NONE) { 499 if (opener_id == MSG_ROUTING_NONE) {
494 did_show_ = true; 500 did_show_ = true;
495 CompleteInit(parent_hwnd); 501 // TODO(fsamuel): Telling the RenderView to delay
502 // deferred updates doesn't seem to work correctly.
503 // This needs more investigation.
504 CompleteInit(parent_hwnd, false);
496 } 505 }
497 506
498 g_view_map.Get().insert(std::make_pair(webview(), this)); 507 g_view_map.Get().insert(std::make_pair(webview(), this));
499 webkit_preferences_.Apply(webview()); 508 webkit_preferences_.Apply(webview());
509
510 // This needs to be before initializeMainFrame it seems.
511 // PpapiMsg_CreateChannel messages can get lost if the guest
512 // observer has not been constructed before a sync message.
513 if (!guest_observer_)
514 guest_observer_ = new GuestRenderViewObserver(this);
515
500 webview()->initializeMainFrame(this); 516 webview()->initializeMainFrame(this);
501 if (!frame_name.empty()) 517 if (!frame_name.empty())
502 webview()->mainFrame()->setName(frame_name); 518 webview()->mainFrame()->setName(frame_name);
503 webview()->settings()->setMinimumTimerInterval( 519 webview()->settings()->setMinimumTimerInterval(
504 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : 520 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval :
505 webkit_glue::kForegroundTabTimerInterval); 521 webkit_glue::kForegroundTabTimerInterval);
506 522
507 OnSetRendererPrefs(renderer_prefs); 523 OnSetRendererPrefs(renderer_prefs);
508 524
509 host_window_ = parent_hwnd; 525 host_window_ = parent_hwnd;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 gfx::NativeViewId parent_hwnd, 628 gfx::NativeViewId parent_hwnd,
613 int32 opener_id, 629 int32 opener_id,
614 const content::RendererPreferences& renderer_prefs, 630 const content::RendererPreferences& renderer_prefs,
615 const WebPreferences& webkit_prefs, 631 const WebPreferences& webkit_prefs,
616 SharedRenderViewCounter* counter, 632 SharedRenderViewCounter* counter,
617 int32 routing_id, 633 int32 routing_id,
618 int32 surface_id, 634 int32 surface_id,
619 int64 session_storage_namespace_id, 635 int64 session_storage_namespace_id,
620 const string16& frame_name, 636 const string16& frame_name,
621 int32 next_page_id, 637 int32 next_page_id,
622 const WebKit::WebScreenInfo& screen_info) { 638 const WebKit::WebScreenInfo& screen_info,
639 bool guest) {
623 DCHECK(routing_id != MSG_ROUTING_NONE); 640 DCHECK(routing_id != MSG_ROUTING_NONE);
624 return new RenderViewImpl( 641 return new RenderViewImpl(
625 parent_hwnd, 642 parent_hwnd,
626 opener_id, 643 opener_id,
627 renderer_prefs, 644 renderer_prefs,
628 webkit_prefs, 645 webkit_prefs,
629 counter, 646 counter,
630 routing_id, 647 routing_id,
631 surface_id, 648 surface_id,
632 session_storage_namespace_id, 649 session_storage_namespace_id,
633 frame_name, 650 frame_name,
634 next_page_id, 651 next_page_id,
635 screen_info); 652 screen_info,
653 guest);
636 } 654 }
637 655
638 WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( 656 WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler(
639 WebKit::WebPeerConnectionHandlerClient* client) { 657 WebKit::WebPeerConnectionHandlerClient* client) {
640 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 658 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
641 if (!cmd_line->HasSwitch(switches::kEnableMediaStream)) 659 if (!cmd_line->HasSwitch(switches::kEnableMediaStream))
642 return NULL; 660 return NULL;
643 EnsureMediaStreamImpl(); 661 EnsureMediaStreamImpl();
644 if (!media_stream_impl_.get()) 662 if (!media_stream_impl_.get())
645 return NULL; 663 return NULL;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 837 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
820 #endif 838 #endif
821 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 839 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
822 OnSetHistoryLengthAndPrune) 840 OnSetHistoryLengthAndPrune)
823 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 841 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
824 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) 842 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit)
825 843
826 // Have the super handle all other messages. 844 // Have the super handle all other messages.
827 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 845 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
828 IPC_END_MESSAGE_MAP() 846 IPC_END_MESSAGE_MAP()
829
830 if (!msg_is_ok) { 847 if (!msg_is_ok) {
831 // The message had a handler, but its deserialization failed. 848 // The message had a handler, but its deserialization failed.
832 // Kill the renderer to avoid potential spoofing attacks. 849 // Kill the renderer to avoid potential spoofing attacks.
833 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; 850 CHECK(false) << "Unable to deserialize message in RenderViewImpl.";
834 } 851 }
835
836 return handled; 852 return handled;
837 } 853 }
838 854
839 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { 855 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
840 MaybeHandleDebugURL(params.url); 856 MaybeHandleDebugURL(params.url);
841 if (!webview()) 857 if (!webview())
842 return; 858 return;
843 859
844 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); 860 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url));
845 861
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 int64 cloned_session_storage_namespace_id; 1475 int64 cloned_session_storage_namespace_id;
1460 1476
1461 RenderThread::Get()->Send( 1477 RenderThread::Get()->Send(
1462 new ViewHostMsg_CreateWindow(params, 1478 new ViewHostMsg_CreateWindow(params,
1463 &routing_id, 1479 &routing_id,
1464 &surface_id, 1480 &surface_id,
1465 &cloned_session_storage_namespace_id)); 1481 &cloned_session_storage_namespace_id));
1466 if (routing_id == MSG_ROUTING_NONE) 1482 if (routing_id == MSG_ROUTING_NONE)
1467 return NULL; 1483 return NULL;
1468 1484
1485 // TODO(fsamuel): The host renderer needs to be able to
1486 // control whether the guest renderer is allowed to do this
1487 // or not. This current behavior is not well defined.
1469 RenderViewImpl* view = RenderViewImpl::Create( 1488 RenderViewImpl* view = RenderViewImpl::Create(
1470 0, 1489 0,
1471 routing_id_, 1490 routing_id_,
1472 renderer_preferences_, 1491 renderer_preferences_,
1473 webkit_preferences_, 1492 webkit_preferences_,
1474 shared_popup_counter_, 1493 shared_popup_counter_,
1475 routing_id, 1494 routing_id,
1476 surface_id, 1495 surface_id,
1477 cloned_session_storage_namespace_id, 1496 cloned_session_storage_namespace_id,
1478 frame_name, 1497 frame_name,
1479 1, 1498 1,
1480 screen_info_); 1499 screen_info_,
1500 guest_);
1481 view->opened_by_user_gesture_ = params.user_gesture; 1501 view->opened_by_user_gesture_ = params.user_gesture;
1482 1502
1483 // Record whether the creator frame is trying to suppress the opener field. 1503 // Record whether the creator frame is trying to suppress the opener field.
1484 view->opener_suppressed_ = params.opener_suppressed; 1504 view->opener_suppressed_ = params.opener_suppressed;
1485 1505
1486 // Record the security origin of the creator. 1506 // Record the security origin of the creator.
1487 GURL creator_url(creator->document().securityOrigin().toString().utf8()); 1507 GURL creator_url(creator->document().securityOrigin().toString().utf8());
1488 if (!creator_url.is_valid() || !creator_url.IsStandard()) 1508 if (!creator_url.is_valid() || !creator_url.IsStandard())
1489 creator_url = GURL(); 1509 creator_url = GURL();
1490 view->creator_url_ = creator_url; 1510 view->creator_url_ = creator_url;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( 1562 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D(
1543 const WebGraphicsContext3D::Attributes& attributes) { 1563 const WebGraphicsContext3D::Attributes& attributes) {
1544 return createGraphicsContext3D(attributes, true); 1564 return createGraphicsContext3D(attributes, true);
1545 } 1565 }
1546 1566
1547 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( 1567 WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D(
1548 const WebGraphicsContext3D::Attributes& attributes, 1568 const WebGraphicsContext3D::Attributes& attributes,
1549 bool direct) { 1569 bool direct) {
1550 if (!webview()) 1570 if (!webview())
1551 return NULL; 1571 return NULL;
1572
1573 if (guest_observer_ && guest_observer_->GetWebGraphicsContext3D())
1574 return guest_observer_->GetWebGraphicsContext3D();
1552 // The WebGraphicsContext3DInProcessImpl code path is used for 1575 // The WebGraphicsContext3DInProcessImpl code path is used for
1553 // layout tests (though not through this code) as well as for 1576 // layout tests (though not through this code) as well as for
1554 // debugging and bringing up new ports. 1577 // debugging and bringing up new ports.
1555 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { 1578 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
1556 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( 1579 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
1557 attributes, direct); 1580 attributes, direct);
1558 } else { 1581 } else {
1559 int surface = direct ? surface_id() : 0; 1582 int surface = direct ? surface_id() : 0;
1560 1583
1561 GURL url; 1584 GURL url;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 2079
2057 bool RenderViewImpl::isPointerLocked() { 2080 bool RenderViewImpl::isPointerLocked() {
2058 return mouse_lock_dispatcher_->IsMouseLockedTo( 2081 return mouse_lock_dispatcher_->IsMouseLockedTo(
2059 webwidget_mouse_lock_target_.get()); 2082 webwidget_mouse_lock_target_.get());
2060 } 2083 }
2061 2084
2062 // WebKit::WebFrameClient ----------------------------------------------------- 2085 // WebKit::WebFrameClient -----------------------------------------------------
2063 2086
2064 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, 2087 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame,
2065 const WebPluginParams& params) { 2088 const WebPluginParams& params) {
2089
2090 // The browser plugin is a special kind of pepper plugin
2091 // that loads asynchronously. We first create a placeholder here.
2092 // When a guest is ready to be displayed, we swap out the placeholder
2093 // with the guest.
2094 if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType)
2095 return BrowserPluginPlaceholder::Create(this, frame, params);
2096
2066 WebPlugin* plugin = NULL; 2097 WebPlugin* plugin = NULL;
2067 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( 2098 if (content::GetContentClient()->renderer()->OverrideCreatePlugin(
2068 this, frame, params, &plugin)) { 2099 this, frame, params, &plugin)) {
2069 return plugin; 2100 return plugin;
2070 } 2101 }
2071 2102
2072 webkit::WebPluginInfo info; 2103 webkit::WebPluginInfo info;
2073 std::string mime_type; 2104 std::string mime_type;
2074 bool found = GetPluginInfo(params.url, frame->top()->document().url(), 2105 bool found = GetPluginInfo(params.url, frame->top()->document().url(),
2075 params.mimeType.utf8(), &info, &mime_type); 2106 params.mimeType.utf8(), &info, &mime_type);
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
3425 if (node.isContentEditable()) { 3456 if (node.isContentEditable()) {
3426 is_editable_node = true; 3457 is_editable_node = true;
3427 } else if (node.isElementNode()) { 3458 } else if (node.isElementNode()) {
3428 is_editable_node = 3459 is_editable_node =
3429 node.toConst<WebElement>().isTextFormControlElement(); 3460 node.toConst<WebElement>().isTextFormControlElement();
3430 } 3461 }
3431 } 3462 }
3432 return is_editable_node; 3463 return is_editable_node;
3433 } 3464 }
3434 3465
3466 WebKit::WebPlugin* RenderViewImpl::CreateBrowserPlugin(
3467 base::ProcessHandle process_handle,
3468 const IPC::ChannelHandle& channel_handle,
3469 const WebKit::WebPluginParams& params) {
3470 // We do not currently support guests hosting guests.
3471 DCHECK(!guest_);
3472 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
3473 pepper_delegate_.CreateBrowserPluginModule(process_handle,
3474 channel_handle));
3475 return new webkit::ppapi::WebPluginImpl(
3476 pepper_module.get(), params, pepper_delegate_.AsWeakPtr());
3477 }
3478
3435 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( 3479 WebKit::WebPlugin* RenderViewImpl::CreatePlugin(
3436 WebKit::WebFrame* frame, 3480 WebKit::WebFrame* frame,
3437 const webkit::WebPluginInfo& info, 3481 const webkit::WebPluginInfo& info,
3438 const WebKit::WebPluginParams& params) { 3482 const WebKit::WebPluginParams& params) {
3483
3439 bool pepper_plugin_was_registered = false; 3484 bool pepper_plugin_was_registered = false;
3440 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 3485 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
3441 pepper_delegate_.CreatePepperPluginModule(info, 3486 pepper_delegate_.CreatePepperPluginModule(info,
3442 &pepper_plugin_was_registered)); 3487 &pepper_plugin_was_registered));
3443 if (pepper_plugin_was_registered) { 3488 if (pepper_plugin_was_registered) {
3444 if (!pepper_module) 3489 if (!pepper_module)
3445 return NULL; 3490 return NULL;
3446 return new webkit::ppapi::WebPluginImpl( 3491 return new webkit::ppapi::WebPluginImpl(
3447 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); 3492 pepper_module.get(), params, pepper_delegate_.AsWeakPtr());
3448 } 3493 }
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
4478 } 4523 }
4479 4524
4480 void RenderViewImpl::OnViewContextSwapBuffersComplete() { 4525 void RenderViewImpl::OnViewContextSwapBuffersComplete() {
4481 RenderWidget::OnSwapBuffersComplete(); 4526 RenderWidget::OnSwapBuffersComplete();
4482 } 4527 }
4483 4528
4484 void RenderViewImpl::OnViewContextSwapBuffersAborted() { 4529 void RenderViewImpl::OnViewContextSwapBuffersAborted() {
4485 RenderWidget::OnSwapBuffersAborted(); 4530 RenderWidget::OnSwapBuffersAborted();
4486 } 4531 }
4487 4532
4533 void RenderViewImpl::OnGuestReady() {
4534 host_window_set_ = true;
4535 DoDeferredUpdate();
4536 }
4537
4488 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( 4538 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint(
4489 const gfx::Rect& paint_bounds, 4539 const gfx::Rect& paint_bounds,
4490 TransportDIB** dib, 4540 TransportDIB** dib,
4491 gfx::Rect* location, 4541 gfx::Rect* location,
4492 gfx::Rect* clip) { 4542 gfx::Rect* clip) {
4493 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( 4543 return pepper_delegate_.GetBitmapForOptimizedPluginPaint(
4494 paint_bounds, dib, location, clip); 4544 paint_bounds, dib, location, clip);
4495 } 4545 }
4496 4546
4497 gfx::Point RenderViewImpl::GetScrollOffset() { 4547 gfx::Point RenderViewImpl::GetScrollOffset() {
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
5117 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5167 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5118 return !!RenderThreadImpl::current()->compositor_thread(); 5168 return !!RenderThreadImpl::current()->compositor_thread();
5119 } 5169 }
5120 5170
5121 void RenderViewImpl::OnJavaBridgeInit() { 5171 void RenderViewImpl::OnJavaBridgeInit() {
5122 DCHECK(!java_bridge_dispatcher_.get()); 5172 DCHECK(!java_bridge_dispatcher_.get());
5123 #if defined(ENABLE_JAVA_BRIDGE) 5173 #if defined(ENABLE_JAVA_BRIDGE)
5124 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5174 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5125 #endif 5175 #endif
5126 } 5176 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698