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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 WebFileChooserCompletion* c) | 403 WebFileChooserCompletion* c) |
404 : params(p), | 404 : params(p), |
405 completion(c) { | 405 completion(c) { |
406 } | 406 } |
407 ViewHostMsg_RunFileChooser_Params params; | 407 ViewHostMsg_RunFileChooser_Params params; |
408 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 408 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
409 }; | 409 }; |
410 | 410 |
411 RenderView::RenderView(RenderThreadBase* render_thread, | 411 RenderView::RenderView(RenderThreadBase* render_thread, |
412 gfx::NativeViewId parent_hwnd, | 412 gfx::NativeViewId parent_hwnd, |
| 413 gfx::PluginWindowHandle compositing_surface, |
413 int32 opener_id, | 414 int32 opener_id, |
414 const RendererPreferences& renderer_prefs, | 415 const RendererPreferences& renderer_prefs, |
415 const WebPreferences& webkit_prefs, | 416 const WebPreferences& webkit_prefs, |
416 SharedRenderViewCounter* counter, | 417 SharedRenderViewCounter* counter, |
417 int32 routing_id, | 418 int32 routing_id, |
418 int64 session_storage_namespace_id, | 419 int64 session_storage_namespace_id, |
419 const string16& frame_name) | 420 const string16& frame_name) |
420 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), | 421 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), |
421 webkit_preferences_(webkit_prefs), | 422 webkit_preferences_(webkit_prefs), |
422 send_content_state_immediately_(false), | 423 send_content_state_immediately_(false), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 481 |
481 render_thread_->AddRoute(routing_id_, this); | 482 render_thread_->AddRoute(routing_id_, this); |
482 // Take a reference on behalf of the RenderThread. This will be balanced | 483 // Take a reference on behalf of the RenderThread. This will be balanced |
483 // when we receive ViewMsg_Close. | 484 // when we receive ViewMsg_Close. |
484 AddRef(); | 485 AddRef(); |
485 | 486 |
486 // If this is a popup, we must wait for the CreatingNew_ACK message before | 487 // If this is a popup, we must wait for the CreatingNew_ACK message before |
487 // completing initialization. Otherwise, we can finish it now. | 488 // completing initialization. Otherwise, we can finish it now. |
488 if (opener_id == MSG_ROUTING_NONE) { | 489 if (opener_id == MSG_ROUTING_NONE) { |
489 did_show_ = true; | 490 did_show_ = true; |
490 CompleteInit(parent_hwnd); | 491 CompleteInit(parent_hwnd, compositing_surface); |
491 } | 492 } |
492 | 493 |
493 host_window_ = parent_hwnd; | 494 host_window_ = parent_hwnd; |
494 | 495 |
495 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 496 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
496 if (command_line.HasSwitch(switches::kDomAutomationController)) | 497 if (command_line.HasSwitch(switches::kDomAutomationController)) |
497 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 498 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
498 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 499 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
499 WebAccessibilityCache::enableAccessibility(); | 500 WebAccessibilityCache::enableAccessibility(); |
500 | 501 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 RenderView* RenderView::FromWebView(WebView* webview) { | 564 RenderView* RenderView::FromWebView(WebView* webview) { |
564 ViewMap* views = g_view_map.Pointer(); | 565 ViewMap* views = g_view_map.Pointer(); |
565 ViewMap::iterator it = views->find(webview); | 566 ViewMap::iterator it = views->find(webview); |
566 return it == views->end() ? NULL : it->second; | 567 return it == views->end() ? NULL : it->second; |
567 } | 568 } |
568 | 569 |
569 /*static*/ | 570 /*static*/ |
570 RenderView* RenderView::Create( | 571 RenderView* RenderView::Create( |
571 RenderThreadBase* render_thread, | 572 RenderThreadBase* render_thread, |
572 gfx::NativeViewId parent_hwnd, | 573 gfx::NativeViewId parent_hwnd, |
| 574 gfx::PluginWindowHandle compositing_surface, |
573 int32 opener_id, | 575 int32 opener_id, |
574 const RendererPreferences& renderer_prefs, | 576 const RendererPreferences& renderer_prefs, |
575 const WebPreferences& webkit_prefs, | 577 const WebPreferences& webkit_prefs, |
576 SharedRenderViewCounter* counter, | 578 SharedRenderViewCounter* counter, |
577 int32 routing_id, | 579 int32 routing_id, |
578 int64 session_storage_namespace_id, | 580 int64 session_storage_namespace_id, |
579 const string16& frame_name) { | 581 const string16& frame_name) { |
580 DCHECK(routing_id != MSG_ROUTING_NONE); | 582 DCHECK(routing_id != MSG_ROUTING_NONE); |
581 return new RenderView( | 583 return new RenderView( |
582 render_thread, | 584 render_thread, |
583 parent_hwnd, | 585 parent_hwnd, |
| 586 compositing_surface, |
584 opener_id, | 587 opener_id, |
585 renderer_prefs, | 588 renderer_prefs, |
586 webkit_prefs, | 589 webkit_prefs, |
587 counter, | 590 counter, |
588 routing_id, | 591 routing_id, |
589 session_storage_namespace_id, | 592 session_storage_namespace_id, |
590 frame_name); // adds reference | 593 frame_name); // adds reference |
591 } | 594 } |
592 | 595 |
593 // static | 596 // static |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 | 1600 |
1598 render_thread_->Send( | 1601 render_thread_->Send( |
1599 new ViewHostMsg_CreateWindow(params, | 1602 new ViewHostMsg_CreateWindow(params, |
1600 &routing_id, | 1603 &routing_id, |
1601 &cloned_session_storage_namespace_id)); | 1604 &cloned_session_storage_namespace_id)); |
1602 if (routing_id == MSG_ROUTING_NONE) | 1605 if (routing_id == MSG_ROUTING_NONE) |
1603 return NULL; | 1606 return NULL; |
1604 | 1607 |
1605 RenderView* view = RenderView::Create(render_thread_, | 1608 RenderView* view = RenderView::Create(render_thread_, |
1606 0, | 1609 0, |
| 1610 gfx::kNullPluginWindow, |
1607 routing_id_, | 1611 routing_id_, |
1608 renderer_preferences_, | 1612 renderer_preferences_, |
1609 webkit_preferences_, | 1613 webkit_preferences_, |
1610 shared_popup_counter_, | 1614 shared_popup_counter_, |
1611 routing_id, | 1615 routing_id, |
1612 cloned_session_storage_namespace_id, | 1616 cloned_session_storage_namespace_id, |
1613 frame_name); | 1617 frame_name); |
1614 view->opened_by_user_gesture_ = params.user_gesture; | 1618 view->opened_by_user_gesture_ = params.user_gesture; |
1615 | 1619 |
1616 // Record whether the creator frame is trying to suppress the opener field. | 1620 // Record whether the creator frame is trying to suppress the opener field. |
(...skipping 3239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4856 const webkit_glue::CustomContextMenuContext& custom_context) { | 4860 const webkit_glue::CustomContextMenuContext& custom_context) { |
4857 if (custom_context.is_pepper_menu) | 4861 if (custom_context.is_pepper_menu) |
4858 pepper_delegate_.OnContextMenuClosed(custom_context); | 4862 pepper_delegate_.OnContextMenuClosed(custom_context); |
4859 else | 4863 else |
4860 context_menu_node_.reset(); | 4864 context_menu_node_.reset(); |
4861 } | 4865 } |
4862 | 4866 |
4863 void RenderView::OnNetworkStateChanged(bool online) { | 4867 void RenderView::OnNetworkStateChanged(bool online) { |
4864 WebNetworkStateNotifier::setOnLine(online); | 4868 WebNetworkStateNotifier::setOnLine(online); |
4865 } | 4869 } |
OLD | NEW |