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

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: Created 6 years, 5 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 ce08a0e4bb6cdbb993a94ec5eb9a98b3c14f73f8..78ea4defde413f5ff3b44eaa4aead5353b1eea49 100644
--- a/content/browser/renderer_host/legacy_render_widget_host_win.h
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.h
@@ -20,7 +20,8 @@ class WindowEventTarget;
}
namespace content {
-class BrowserAccessibilityManagerWin;
+class BrowserAccessibilityManager;
+class LegacyRenderWidgetHostHWND;
class RenderWidgetHostViewAura;
// Reasons for the existence of this class outlined below:-
@@ -40,6 +41,18 @@ class RenderWidgetHostViewAura;
// fail.
// We should look to get rid of this code when all of the above are fixed.
+// A delegate interface for LegacyRenderWidgetHostHWND to query its owner.
ananta 2014/07/14 18:51:08 The comment here needs to be reworded?. query its
dmazzoni 2014/07/29 23:03:05 Done.
+class CONTENT_EXPORT LegacyRenderWidgetHostHWNDDelegate {
+ public:
+ // Get the root BrowserAccessibilityManager representing the accessible
+ // state of this WebContents. This should always return a valid object,
+ // but the object may change as the user navigates.
+ virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() = 0;
+
+ // This will be called when the HWND is destroyed.
+ virtual void OnLegacyHwndDestroyed(LegacyRenderWidgetHostHWND* owner) = 0;
+};
+
// 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
@@ -51,6 +64,8 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
NON_EXPORTED_BASE(ATL::CWindow),
ATL::CWinTraits<WS_CHILD> > {
public:
+ virtual ~LegacyRenderWidgetHostHWND();
+
DECLARE_WND_CLASS_EX(L"Chrome_RenderWidgetHostHWND", CS_DBLCLKS, 0);
typedef ATL::CWindowImpl<LegacyRenderWidgetHostHWND,
@@ -60,10 +75,16 @@ 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);
+ static LegacyRenderWidgetHostHWND* Create(
+ HWND parent,
+ LegacyRenderWidgetHostHWNDDelegate* delegate);
- // Destroys the HWND managed by this class.
- void Destroy();
+ // Create an instance of LegacyRenderWidgetHostHWND purely for testing.
+ // Its parent is the desktop window and it always delegates to one
+ // BrowserAccessibilityManager. It deletes itself when the HWND is
+ // destroyed.
+ static LegacyRenderWidgetHostHWND* CreateForTesting(
+ BrowserAccessibilityManager* manager);
BEGIN_MSG_MAP_EX(LegacyRenderWidgetHostHWND)
MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject)
@@ -85,6 +106,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.
@@ -94,13 +117,6 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
IAccessible* window_accessible() { return window_accessible_; }
- void set_browser_accessibility_manager(
- content::BrowserAccessibilityManagerWin* manager) {
- manager_ = manager;
- }
-
- void OnManagerDeleted(content::BrowserAccessibilityManagerWin* manager);
-
// Functions to show and hide the window.
void Show();
void Hide();
@@ -108,18 +124,12 @@ 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();
@@ -145,18 +155,16 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
LRESULT OnSize(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnSysCommand(UINT message, WPARAM w_param, LPARAM l_param);
- content::BrowserAccessibilityManagerWin* manager_;
+ LegacyRenderWidgetHostHWNDDelegate* delegate_;
+ BrowserAccessibilityManager* manager_for_testing_;
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