diff options
author | alicet@chromium.org <alicet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 21:53:24 +0000 |
---|---|---|
committer | alicet@chromium.org <alicet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 21:53:24 +0000 |
commit | 5a89a75e28cb4e735b7315e05cfc657a9b664928 (patch) | |
tree | 4770a964b6c2fa4714ea45e87e72bf333e42bb39 /ui/views/bubble | |
parent | d1d67d89bbb69e71f50ba9a0e6ede189f0ae1cff (diff) | |
download | chromium_src-5a89a75e28cb4e735b7315e05cfc657a9b664928.zip chromium_src-5a89a75e28cb4e735b7315e05cfc657a9b664928.tar.gz chromium_src-5a89a75e28cb4e735b7315e05cfc657a9b664928.tar.bz2 |
Update widget initialization for screen lock, settings bubble and menus to set up parent container before widget initialization. This allows widget to be initiated with proper parent bounds taken into initial bounds calculation.
In particular, in compact mode, the default container layer have different bounds and transformation than all other layers. If windows are initialized with the default container and then added to the intended containers, bounds and transformation of the new windows may need to be updated after this move between layers.
BUG=112322
TEST=tested on alex for screenlock/volume/brightness bubbles to show up even when the user was on a new window in compact mode.
Review URL: http://codereview.chromium.org/9314041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r-- | ui/views/bubble/bubble_delegate.cc | 11 | ||||
-rw-r--r-- | ui/views/bubble/bubble_delegate.h | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc index 1ed4a4d..9680b9e 100644 --- a/ui/views/bubble/bubble_delegate.cc +++ b/ui/views/bubble/bubble_delegate.cc @@ -25,7 +25,10 @@ Widget* CreateBubbleWidget(BubbleDelegateView* bubble, Widget* parent) { Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE); bubble_params.delegate = bubble; bubble_params.transparent = true; - bubble_params.parent_widget = parent; + if (bubble->parent_window()) + bubble_params.parent = bubble->parent_window(); + else + bubble_params.parent_widget = parent; if (bubble->use_focusless()) bubble_params.can_activate = false; #if defined(OS_WIN) && !defined(USE_AURA) @@ -95,7 +98,8 @@ BubbleDelegateView::BubbleDelegateView() margin_(kDefaultMargin), original_opacity_(255), border_widget_(NULL), - use_focusless_(false) { + use_focusless_(false), + parent_window_(NULL) { set_background(views::Background::CreateSolidBackground(color_)); AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0)); } @@ -111,7 +115,8 @@ BubbleDelegateView::BubbleDelegateView( margin_(kDefaultMargin), original_opacity_(255), border_widget_(NULL), - use_focusless_(false) { + use_focusless_(false), + parent_window_(NULL) { set_background(views::Background::CreateSolidBackground(color_)); AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0)); } diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h index ca1bc482..81fd9c8 100644 --- a/ui/views/bubble/bubble_delegate.h +++ b/ui/views/bubble/bubble_delegate.h @@ -72,6 +72,9 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, int margin() const { return margin_; } void set_margin(int margin) { margin_ = margin; } + gfx::NativeWindow parent_window() const { return parent_window_; } + void set_parent_window(gfx::NativeWindow window) { parent_window_ = window; } + bool use_focusless() const { return use_focusless_; } void set_use_focusless(bool use_focusless) { use_focusless_ = use_focusless; @@ -152,6 +155,9 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, // These bubbles are not interactive and should not gain focus. bool use_focusless_; + // Parent native window of the bubble. + gfx::NativeWindow parent_window_; + DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); }; |