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

Unified Diff: chrome/browser/ui/views/apps/native_app_window_views.cc

Issue 26427002: Add always-on-top property to app windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cache state of isAlwaysOnTop in widget. Fixed clobber in x11 window init. Created 7 years, 2 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: chrome/browser/ui/views/apps/native_app_window_views.cc
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
index 6a07a7b002209ff6f7658e2307ae170d30ec83f1..b001cbe341615f145c302a5be7dd306d7c4e3c5f 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -169,6 +169,7 @@ void NativeAppWindowViews::InitializeDefaultWindow(
// TODO(erg): Conceptually, these are toplevel windows, but we theoretically
// could plumb context through to here in some cases.
init_params.top_level = true;
+ init_params.keep_on_top = create_params.always_on_top;
gfx::Rect window_bounds = create_params.bounds;
bool position_specified =
window_bounds.x() != INT_MIN && window_bounds.y() != INT_MIN;
@@ -407,14 +408,16 @@ void NativeAppWindowViews::FlashFrame(bool flash) {
}
bool NativeAppWindowViews::IsAlwaysOnTop() const {
- if (!shell_window_->window_type_is_panel())
- return false;
+ if (shell_window_->window_type_is_panel()) {
#if defined(USE_ASH)
return ash::wm::GetWindowState(window_->GetNativeWindow())->
panel_attached();
#else
return true;
#endif
+ } else {
+ return window_->IsAlwaysOnTop();
+ }
}
gfx::Insets NativeAppWindowViews::GetFrameInsets() const {
@@ -436,6 +439,11 @@ gfx::Insets NativeAppWindowViews::GetFrameInsets() const {
void NativeAppWindowViews::HideWithApp() {}
void NativeAppWindowViews::ShowWithApp() {}
+void NativeAppWindowViews::SetAlwaysOnTop(bool always_on_top) {
+ window_->SetAlwaysOnTop(always_on_top);
+ shell_window_->OnNativeWindowChanged();
+}
+
gfx::NativeView NativeAppWindowViews::GetHostView() const {
return window_->GetNativeView();
}

Powered by Google App Engine
This is Rietveld 408576698