
For each caller of GetRenderViewHost(), which used to be a caller of RenderViewHost::From(RenderWidgetHost*), add an appropriate method to the owner delegate and call that directly instead. Mostly this is pretty straightforward, and the code that called GetRenderViewHost() to get something moves into RenderViewHostImpl (as the impl of the owner delegate) which returns that something to the RenderWidgetHost code. One exception is that on mac we punch a hole in DEPS to allow use of WebContents directly from the RenderWidgetHostView. In order to not extend DEPS of web_contents.h beyond those files into the RenderViewHostImpl implementation, we a) Put GetWebContentsForWidget() behind #ifdef OS_MACOSX so the API does not exist elsewhere. b) Put the implementation of this into its own .cc file, which has the appropriate DEPS hole punching applied to it. This is all pretty sad looking to me, but it seems that the RenderWidgetHostViewMac code should really be going through a delegate and it is not, and this is the result. R=asvitkine@chromium.org, avi@chromium.org TBR=dcheng Change-Id: I9a812381126f049a2f52e420bddde9d00e72f028 Bug: 912193 Reviewed-on: https://chromium-review.googlesource.com/c/1385467 Commit-Queue: danakj <danakj@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/master@{#620379}
38 lines
917 B
C++
38 lines
917 B
C++
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "content/test/stub_render_widget_host_owner_delegate.h"
|
|
|
|
#include "content/public/common/web_preferences.h"
|
|
|
|
namespace content {
|
|
|
|
bool StubRenderWidgetHostOwnerDelegate::MayRenderWidgetForwardKeyboardEvent(
|
|
const NativeWebKeyboardEvent& key_event) {
|
|
return true;
|
|
}
|
|
|
|
bool StubRenderWidgetHostOwnerDelegate::ShouldContributePriorityToProcess() {
|
|
return false;
|
|
}
|
|
|
|
bool StubRenderWidgetHostOwnerDelegate::IsMainFrameActive() {
|
|
return true;
|
|
}
|
|
|
|
bool StubRenderWidgetHostOwnerDelegate::IsNeverVisible() {
|
|
return false;
|
|
}
|
|
|
|
WebPreferences
|
|
StubRenderWidgetHostOwnerDelegate::GetWebkitPreferencesForWidget() {
|
|
return {};
|
|
}
|
|
|
|
FrameTreeNode* StubRenderWidgetHostOwnerDelegate::GetFocusedFrame() {
|
|
return nullptr;
|
|
}
|
|
|
|
} // namespace content
|