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

Unified Diff: chrome/browser/ui/views/first_run_bubble.cc

Issue 7097002: Correctly locate the browser frame window to prevent a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/first_run_bubble.cc
===================================================================
--- chrome/browser/ui/views/first_run_bubble.cc (revision 89019)
+++ chrome/browser/ui/views/first_run_bubble.cc (working copy)
@@ -44,6 +44,15 @@
// Margin around close button.
const int kMarginRightOfCloseButton = 7;
+// The bubble's HWND is actually owned by the border widget, and it's the border
+// widget that's owned by the frame window the bubble is anchored to. This
+// function makes the two leaps necessary to go from the bubble contents HWND
+// to the frame HWND.
+HWND GetLogicalBubbleOwner(HWND bubble_hwnd) {
+ HWND border_widget_hwnd = GetWindow(bubble_hwnd, GW_OWNER);
+ return GetWindow(border_widget_hwnd, GW_OWNER);
+}
+
} // namespace
// Base class for implementations of the client view which appears inside the
@@ -514,10 +523,11 @@
// have to call it again before activating the bubble to prevent the parent
// window from rendering inactive.
// TODO(beng): this only works in custom-frame mode, not glass-frame mode.
+ HWND bubble_owner = GetLogicalBubbleOwner(GetNativeView());
views::NativeWidget* parent =
- views::NativeWidget::GetNativeWidgetForNativeView(GetParent());
+ views::NativeWidget::GetNativeWidgetForNativeView(bubble_owner);
if (parent)
- parent->GetWidget()->GetTopLevelWidget()->DisableInactiveRendering();
+ parent->GetWidget()->DisableInactiveRendering();
// Reactivate the FirstRunBubble so it responds to OnActivate messages.
SetWindowPos(GetParent(), 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_SHOWWINDOW);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698