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

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

Issue 387353004: Create only a single LegacyRenderWidgetHostHWND per WebContentsViewAura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render_frame_ax_3
Patch Set: Oops, forgot to upload delegate in new file Created 6 years, 2 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 a78de28a7bbc291941efd5d9ded3b0058782b374..3222e05c1d41bd77b36adad77ae2f40e92f79eb8 100644
--- a/content/browser/renderer_host/legacy_render_widget_host_win.h
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.h
@@ -13,6 +13,7 @@
#include "base/basictypes.h"
#include "base/win/scoped_comptr.h"
#include "content/common/content_export.h"
+#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
namespace ui {
@@ -20,8 +21,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.
@@ -39,12 +38,11 @@ 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),
@@ -56,13 +54,14 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
NON_EXPORTED_BASE(ATL::CWindow),
ATL::CWinTraits<WS_CHILD> > Base;
+ virtual ~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)
@@ -84,6 +83,8 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
MESSAGE_HANDLER_EX(WM_SIZE, OnSize)
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.
@@ -100,18 +101,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:
- virtual void OnFinalMessage(HWND hwnd) override;
-
private:
- LegacyRenderWidgetHostHWND(HWND parent);
- ~LegacyRenderWidgetHostHWND();
+ LegacyRenderWidgetHostHWND(HWND parent,
+ LegacyRenderWidgetHostHWNDDelegate* delegate);
bool Init();
@@ -136,17 +128,16 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
LRESULT OnNCCalcSize(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnSize(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_;
-
DISALLOW_COPY_AND_ASSIGN(LegacyRenderWidgetHostHWND);
};
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_LEGACY_RENDER_WIDGET_HOST_WIN_H_
-

Powered by Google App Engine
This is Rietveld 408576698