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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 1996163002: Ensure LegacyRenderWidgetHostHWND is always created. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback from sadrul Created 4 years, 7 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
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | no next file » | 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/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 495
496 WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents, 496 WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents,
497 WebContentsViewDelegate* delegate) 497 WebContentsViewDelegate* delegate)
498 : web_contents_(web_contents), 498 : web_contents_(web_contents),
499 delegate_(delegate), 499 delegate_(delegate),
500 current_drag_op_(blink::WebDragOperationNone), 500 current_drag_op_(blink::WebDragOperationNone),
501 drag_dest_delegate_(NULL), 501 drag_dest_delegate_(NULL),
502 current_rvh_for_drag_(NULL), 502 current_rvh_for_drag_(NULL),
503 current_overscroll_gesture_(OVERSCROLL_NONE), 503 current_overscroll_gesture_(OVERSCROLL_NONE),
504 completed_overscroll_gesture_(OVERSCROLL_NONE), 504 completed_overscroll_gesture_(OVERSCROLL_NONE),
505 navigation_overlay_(nullptr) {} 505 navigation_overlay_(nullptr),
506 init_rwhv_with_null_parent_for_testing_(false) {}
506 507
507 void WebContentsViewAura::SetDelegateForTesting( 508 void WebContentsViewAura::SetDelegateForTesting(
508 WebContentsViewDelegate* delegate) { 509 WebContentsViewDelegate* delegate) {
509 delegate_.reset(delegate); 510 delegate_.reset(delegate);
510 } 511 }
511 512
512 //////////////////////////////////////////////////////////////////////////////// 513 ////////////////////////////////////////////////////////////////////////////////
513 // WebContentsViewAura, private: 514 // WebContentsViewAura, private:
514 515
515 WebContentsViewAura::~WebContentsViewAura() { 516 WebContentsViewAura::~WebContentsViewAura() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return view ? view->selection_controller() : nullptr; 594 return view ? view->selection_controller() : nullptr;
594 } 595 }
595 596
596 TouchSelectionControllerClientAura* 597 TouchSelectionControllerClientAura*
597 WebContentsViewAura::GetSelectionControllerClient() const { 598 WebContentsViewAura::GetSelectionControllerClient() const {
598 RenderWidgetHostViewAura* view = 599 RenderWidgetHostViewAura* view =
599 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); 600 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView());
600 return view ? view->selection_controller_client() : nullptr; 601 return view ? view->selection_controller_client() : nullptr;
601 } 602 }
602 603
604 gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const {
605 if (init_rwhv_with_null_parent_for_testing_)
606 return nullptr;
607 return window_.get();
608 }
609
603 //////////////////////////////////////////////////////////////////////////////// 610 ////////////////////////////////////////////////////////////////////////////////
604 // WebContentsViewAura, WebContentsView implementation: 611 // WebContentsViewAura, WebContentsView implementation:
605 612
606 gfx::NativeView WebContentsViewAura::GetNativeView() const { 613 gfx::NativeView WebContentsViewAura::GetNativeView() const {
607 return window_.get(); 614 return window_.get();
608 } 615 }
609 616
610 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { 617 gfx::NativeView WebContentsViewAura::GetContentNativeView() const {
611 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); 618 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
612 return rwhv ? rwhv->GetNativeView() : NULL; 619 return rwhv ? rwhv->GetNativeView() : NULL;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // this actually is happening (and somebody isn't accidentally creating the 736 // this actually is happening (and somebody isn't accidentally creating the
730 // view twice), we check for the RVH Factory, which will be set when we're 737 // view twice), we check for the RVH Factory, which will be set when we're
731 // making special ones (which go along with the special views). 738 // making special ones (which go along with the special views).
732 DCHECK(RenderViewHostFactory::has_factory()); 739 DCHECK(RenderViewHostFactory::has_factory());
733 return static_cast<RenderWidgetHostViewBase*>( 740 return static_cast<RenderWidgetHostViewBase*>(
734 render_widget_host->GetView()); 741 render_widget_host->GetView());
735 } 742 }
736 743
737 RenderWidgetHostViewAura* view = 744 RenderWidgetHostViewAura* view =
738 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); 745 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack);
739 view->InitAsChild(GetNativeView()); 746 view->InitAsChild(GetRenderWidgetHostViewParent());
740 747
741 RenderWidgetHostImpl* host_impl = 748 RenderWidgetHostImpl* host_impl =
742 RenderWidgetHostImpl::From(render_widget_host); 749 RenderWidgetHostImpl::From(render_widget_host);
743 750
744 if (!host_impl->is_hidden()) 751 if (!host_impl->is_hidden())
745 view->Show(); 752 view->Show();
746 753
747 // We listen to drag drop events in the newly created view's window. 754 // We listen to drag drop events in the newly created view's window.
748 aura::client::SetDragDropDelegate(view->GetNativeView(), this); 755 aura::client::SetDragDropDelegate(view->GetNativeView(), this);
749 756
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, 1128 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
1122 bool visible) { 1129 bool visible) {
1123 // Ignore any visibility changes in the hierarchy below. 1130 // Ignore any visibility changes in the hierarchy below.
1124 if (window != window_.get() && window_->Contains(window)) 1131 if (window != window_.get() && window_->Contains(window))
1125 return; 1132 return;
1126 1133
1127 web_contents_->UpdateWebContentsVisibility(visible); 1134 web_contents_->UpdateWebContentsVisibility(visible);
1128 } 1135 }
1129 1136
1130 } // namespace content 1137 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698