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.h" | 5 #include "content/renderer/render_view.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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 WebFileChooserCompletion* c) | 400 WebFileChooserCompletion* c) |
401 : params(p), | 401 : params(p), |
402 completion(c) { | 402 completion(c) { |
403 } | 403 } |
404 ViewHostMsg_RunFileChooser_Params params; | 404 ViewHostMsg_RunFileChooser_Params params; |
405 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 405 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
406 }; | 406 }; |
407 | 407 |
408 RenderView::RenderView(RenderThreadBase* render_thread, | 408 RenderView::RenderView(RenderThreadBase* render_thread, |
409 gfx::NativeViewId parent_hwnd, | 409 gfx::NativeViewId parent_hwnd, |
| 410 gfx::PluginWindowHandle compositing_surface, |
410 int32 opener_id, | 411 int32 opener_id, |
411 const RendererPreferences& renderer_prefs, | 412 const RendererPreferences& renderer_prefs, |
412 const WebPreferences& webkit_prefs, | 413 const WebPreferences& webkit_prefs, |
413 SharedRenderViewCounter* counter, | 414 SharedRenderViewCounter* counter, |
414 int32 routing_id, | 415 int32 routing_id, |
415 int64 session_storage_namespace_id, | 416 int64 session_storage_namespace_id, |
416 const string16& frame_name) | 417 const string16& frame_name) |
417 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), | 418 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), |
418 webkit_preferences_(webkit_prefs), | 419 webkit_preferences_(webkit_prefs), |
419 send_content_state_immediately_(false), | 420 send_content_state_immediately_(false), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 477 |
477 render_thread_->AddRoute(routing_id_, this); | 478 render_thread_->AddRoute(routing_id_, this); |
478 // Take a reference on behalf of the RenderThread. This will be balanced | 479 // Take a reference on behalf of the RenderThread. This will be balanced |
479 // when we receive ViewMsg_Close. | 480 // when we receive ViewMsg_Close. |
480 AddRef(); | 481 AddRef(); |
481 | 482 |
482 // If this is a popup, we must wait for the CreatingNew_ACK message before | 483 // If this is a popup, we must wait for the CreatingNew_ACK message before |
483 // completing initialization. Otherwise, we can finish it now. | 484 // completing initialization. Otherwise, we can finish it now. |
484 if (opener_id == MSG_ROUTING_NONE) { | 485 if (opener_id == MSG_ROUTING_NONE) { |
485 did_show_ = true; | 486 did_show_ = true; |
486 CompleteInit(parent_hwnd); | 487 CompleteInit(parent_hwnd, compositing_surface); |
487 } | 488 } |
488 | 489 |
489 host_window_ = parent_hwnd; | 490 host_window_ = parent_hwnd; |
490 | 491 |
491 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 492 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
492 if (command_line.HasSwitch(switches::kDomAutomationController)) | 493 if (command_line.HasSwitch(switches::kDomAutomationController)) |
493 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 494 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
494 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 495 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
495 WebAccessibilityCache::enableAccessibility(); | 496 WebAccessibilityCache::enableAccessibility(); |
496 | 497 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 RenderView* RenderView::FromWebView(WebView* webview) { | 555 RenderView* RenderView::FromWebView(WebView* webview) { |
555 ViewMap* views = g_view_map.Pointer(); | 556 ViewMap* views = g_view_map.Pointer(); |
556 ViewMap::iterator it = views->find(webview); | 557 ViewMap::iterator it = views->find(webview); |
557 return it == views->end() ? NULL : it->second; | 558 return it == views->end() ? NULL : it->second; |
558 } | 559 } |
559 | 560 |
560 /*static*/ | 561 /*static*/ |
561 RenderView* RenderView::Create( | 562 RenderView* RenderView::Create( |
562 RenderThreadBase* render_thread, | 563 RenderThreadBase* render_thread, |
563 gfx::NativeViewId parent_hwnd, | 564 gfx::NativeViewId parent_hwnd, |
| 565 gfx::PluginWindowHandle compositing_surface, |
564 int32 opener_id, | 566 int32 opener_id, |
565 const RendererPreferences& renderer_prefs, | 567 const RendererPreferences& renderer_prefs, |
566 const WebPreferences& webkit_prefs, | 568 const WebPreferences& webkit_prefs, |
567 SharedRenderViewCounter* counter, | 569 SharedRenderViewCounter* counter, |
568 int32 routing_id, | 570 int32 routing_id, |
569 int64 session_storage_namespace_id, | 571 int64 session_storage_namespace_id, |
570 const string16& frame_name) { | 572 const string16& frame_name) { |
571 DCHECK(routing_id != MSG_ROUTING_NONE); | 573 DCHECK(routing_id != MSG_ROUTING_NONE); |
572 return new RenderView( | 574 return new RenderView( |
573 render_thread, | 575 render_thread, |
574 parent_hwnd, | 576 parent_hwnd, |
| 577 compositing_surface, |
575 opener_id, | 578 opener_id, |
576 renderer_prefs, | 579 renderer_prefs, |
577 webkit_prefs, | 580 webkit_prefs, |
578 counter, | 581 counter, |
579 routing_id, | 582 routing_id, |
580 session_storage_namespace_id, | 583 session_storage_namespace_id, |
581 frame_name); // adds reference | 584 frame_name); // adds reference |
582 } | 585 } |
583 | 586 |
584 // static | 587 // static |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 | 1590 |
1588 render_thread_->Send( | 1591 render_thread_->Send( |
1589 new ViewHostMsg_CreateWindow(params, | 1592 new ViewHostMsg_CreateWindow(params, |
1590 &routing_id, | 1593 &routing_id, |
1591 &cloned_session_storage_namespace_id)); | 1594 &cloned_session_storage_namespace_id)); |
1592 if (routing_id == MSG_ROUTING_NONE) | 1595 if (routing_id == MSG_ROUTING_NONE) |
1593 return NULL; | 1596 return NULL; |
1594 | 1597 |
1595 RenderView* view = RenderView::Create(render_thread_, | 1598 RenderView* view = RenderView::Create(render_thread_, |
1596 0, | 1599 0, |
| 1600 gfx::kNullPluginWindow, |
1597 routing_id_, | 1601 routing_id_, |
1598 renderer_preferences_, | 1602 renderer_preferences_, |
1599 webkit_preferences_, | 1603 webkit_preferences_, |
1600 shared_popup_counter_, | 1604 shared_popup_counter_, |
1601 routing_id, | 1605 routing_id, |
1602 cloned_session_storage_namespace_id, | 1606 cloned_session_storage_namespace_id, |
1603 frame_name); | 1607 frame_name); |
1604 view->opened_by_user_gesture_ = params.user_gesture; | 1608 view->opened_by_user_gesture_ = params.user_gesture; |
1605 | 1609 |
1606 // Record whether the creator frame is trying to suppress the opener field. | 1610 // Record whether the creator frame is trying to suppress the opener field. |
(...skipping 3221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4828 const webkit_glue::CustomContextMenuContext& custom_context) { | 4832 const webkit_glue::CustomContextMenuContext& custom_context) { |
4829 if (custom_context.is_pepper_menu) | 4833 if (custom_context.is_pepper_menu) |
4830 pepper_delegate_.OnContextMenuClosed(custom_context); | 4834 pepper_delegate_.OnContextMenuClosed(custom_context); |
4831 else | 4835 else |
4832 context_menu_node_.reset(); | 4836 context_menu_node_.reset(); |
4833 } | 4837 } |
4834 | 4838 |
4835 void RenderView::OnNetworkStateChanged(bool online) { | 4839 void RenderView::OnNetworkStateChanged(bool online) { |
4836 WebNetworkStateNotifier::setOnLine(online); | 4840 WebNetworkStateNotifier::setOnLine(online); |
4837 } | 4841 } |
OLD | NEW |