summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-14 20:10:41 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-14 20:10:41 +0000
commit6443aa7460501212450e0e7a28413aa961b08034 (patch)
tree417d92bbcbf4cb30e6007dc9b4e8ca9e35a9f062
parent1ce7a71f486279fcd7186783058d82167d885b19 (diff)
downloadchromium_src-6443aa7460501212450e0e7a28413aa961b08034.zip
chromium_src-6443aa7460501212450e0e7a28413aa961b08034.tar.gz
chromium_src-6443aa7460501212450e0e7a28413aa961b08034.tar.bz2
Correctly locate the browser frame window to prevent a crash.
http://crbug.com/86072 TEST=chrome --first-run --user-data-dir=t ... wait 5 seconds, there should be no crash! Review URL: http://codereview.chromium.org/7097002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89056 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/first_run_bubble.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc
index 7708120..c4d1e66 100644
--- a/chrome/browser/ui/views/first_run_bubble.cc
+++ b/chrome/browser/ui/views/first_run_bubble.cc
@@ -44,6 +44,15 @@ const int kStringSeparationPadding = 2;
// 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 @@ void FirstRunBubble::EnableParent() {
// 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);