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

Unified Diff: content/browser/renderer_host/legacy_render_widget_host_win.h

Issue 1987903002: Create only a single LegacyRenderWidgetHostHWND per WebContentsViewAura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix last merge issue 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/legacy_render_widget_host_win.h
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.h b/content/browser/renderer_host/legacy_render_widget_host_win.h
index ab2d635e55df4bf4ff7a4ed4140f8a59a28a9bf0..bc496cf62966b290d0755754ae269343ac1517b4 100644
--- a/content/browser/renderer_host/legacy_render_widget_host_win.h
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.h
@@ -16,6 +16,7 @@
#include "base/win/scoped_comptr.h"
#include "content/common/content_export.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/native_widget_types.h"
namespace gfx {
namespace win {
@@ -28,8 +29,6 @@ class WindowEventTarget;
}
namespace content {
-class RenderWidgetHostViewAura;
-
// Reasons for the existence of this class outlined below:-
// 1. Some screen readers expect every tab / every unique web content container
// to be in its own HWND with class name Chrome_RenderWidgetHostHWND.
@@ -47,17 +46,18 @@ class RenderWidgetHostViewAura;
// fail.
// We should look to get rid of this code when all of the above are fixed.
+class LegacyRenderWidgetHostHWNDDelegate;
+
// This class implements a child HWND with the same size as the content area,
-// that delegates its accessibility implementation to the root of the
-// BrowserAccessibilityManager tree. This HWND is hooked up as the parent of
-// the root object in the BrowserAccessibilityManager tree, so when any
-// accessibility client calls ::WindowFromAccessibleObject, they get this
-// HWND instead of the DesktopWindowTreeHostWin.
+// and delegates its accessibility implementation to the
+// gfx::NativeViewAccessible provided by the owner class.
class CONTENT_EXPORT LegacyRenderWidgetHostHWND
: public ATL::CWindowImpl<LegacyRenderWidgetHostHWND,
NON_EXPORTED_BASE(ATL::CWindow),
ATL::CWinTraits<WS_CHILD> > {
public:
+ ~LegacyRenderWidgetHostHWND() override;
+
DECLARE_WND_CLASS_EX(L"Chrome_RenderWidgetHostHWND", CS_DBLCLKS, 0);
typedef ATL::CWindowImpl<LegacyRenderWidgetHostHWND,
@@ -67,10 +67,9 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
// Creates and returns an instance of the LegacyRenderWidgetHostHWND class on
// successful creation of a child window parented to the parent window passed
// in.
- static LegacyRenderWidgetHostHWND* Create(HWND parent);
-
- // Destroys the HWND managed by this class.
- void Destroy();
+ static LegacyRenderWidgetHostHWND* Create(
+ HWND parent,
+ LegacyRenderWidgetHostHWNDDelegate* delegate);
BEGIN_MSG_MAP_EX(LegacyRenderWidgetHostHWND)
MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject)
@@ -93,6 +92,8 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
MESSAGE_HANDLER_EX(WM_WINDOWPOSCHANGED, OnWindowPosChanged)
END_MSG_MAP()
+ // May be deleted at any time by Windows! Other classes should never store
+ // this value.
HWND hwnd() { return m_hWnd; }
// Called when the child window is to be reparented to a new window.
@@ -109,18 +110,9 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
// Resizes the window to the bounds passed in.
void SetBounds(const gfx::Rect& bounds);
- // The pointer to the containing RenderWidgetHostViewAura instance is passed
- // here.
- void set_host(RenderWidgetHostViewAura* host) {
- host_ = host;
- }
-
- protected:
- void OnFinalMessage(HWND hwnd) override;
-
private:
- explicit LegacyRenderWidgetHostHWND(HWND parent);
- ~LegacyRenderWidgetHostHWND() override;
+ LegacyRenderWidgetHostHWND(HWND parent,
+ LegacyRenderWidgetHostHWNDDelegate* delegate);
bool Init();
@@ -146,13 +138,13 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
LRESULT OnSize(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnWindowPosChanged(UINT message, WPARAM w_param, LPARAM l_param);
+ LegacyRenderWidgetHostHWNDDelegate* delegate_;
+
base::win::ScopedComPtr<IAccessible> window_accessible_;
// Set to true if we turned on mouse tracking.
bool mouse_tracking_enabled_;
- RenderWidgetHostViewAura* host_;
-
// This class provides functionality to register the legacy window as a
// Direct Manipulation consumer. This allows us to support smooth scroll
// in Chrome on Windows 10.
@@ -165,4 +157,3 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_LEGACY_RENDER_WIDGET_HOST_WIN_H_
-

Powered by Google App Engine
This is Rietveld 408576698