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: views/widget/native_widget_aura.cc

Issue 8387043: [Aura] Support always-on-top top level window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and address oshima's comments in patch 6 Created 9 years, 1 month 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
« ui/base/x/x11_util.cc ('K') | « ui/base/x/x11_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/native_widget_aura.cc
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index cb4eebafab360b2eb12f222ff2297c5b1f98a8f6..5365327bf17d594f4d004872845526f98f319f1f 100644
--- a/views/widget/native_widget_aura.cc
+++ b/views/widget/native_widget_aura.cc
@@ -144,6 +144,9 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
gfx::NativeView parent = params.GetParent();
if (parent)
parent->AddTransientChild(window_);
+ // SetAlwaysOnTop before SetParent so that always-on-top container is used.
+ if (params.keep_on_top)
+ SetAlwaysOnTop(true);
window_->SetParent(NULL);
}
// TODO(beng): do this some other way.
@@ -418,8 +421,32 @@ bool NativeWidgetAura::IsActive() const {
}
void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
- // http://crbug.com/102582
- NOTIMPLEMENTED();
+ switch (window_->type()) {
+ case aura::WINDOW_TYPE_NORMAL:
+ case aura::WINDOW_TYPE_POPUP:
+ SetNativeWindowProperty(aura::kAlwaysOnTopKey,
+ reinterpret_cast<void*>(on_top));
+
+ // Having a parent means it's added to some container already.
+ // Doing SetParent again here to make sure window_ is put in the right
+ // container.
+ // TODO(xiyuan): Optimize and only switch containers when necessary.
+ if (window_->parent()) {
+ window_->parent()->RemoveChild(window_);
+ window_->SetParent(NULL);
+ }
+
+ break;
+ case aura::WINDOW_TYPE_MENU:
+ case aura::WINDOW_TYPE_TOOLTIP:
+ // Menu and tooptip has their own container and ignores always-on-top.
+ break;
+ default:
+ NOTREACHED() << "Window " << window_->id()
+ << " of type " << window_->type()
+ << " does not support always-on-top.";
+ break;
+ }
oshima 2011/11/04 20:40:08 Sorry I missed this part in previous review. This
xiyuan 2011/11/04 22:40:21 Done.
}
void NativeWidgetAura::Maximize() {
« ui/base/x/x11_util.cc ('K') | « ui/base/x/x11_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698