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

Unified Diff: ui/views/controls/native/native_view_host.cc

Issue 1746013002: Hide/show widget on Windows screen lock/unlock Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 4 years, 10 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 | « ui/views/controls/native/native_view_host.h ('k') | ui/views/view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/native/native_view_host.cc
diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
index 452e5966b48334f7843fb332dd765b0095aafec8..ea6db3839a7577712f13ce4cbd5fe6afad8b42c7 100644
--- a/ui/views/controls/native/native_view_host.cc
+++ b/ui/views/controls/native/native_view_host.cc
@@ -127,6 +127,22 @@ void NativeViewHost::VisibilityChanged(View* starting_from, bool is_visible) {
Layout();
}
+void NativeViewHost::OnSoftVisibilityChanged(bool visible) {
+ if (!native_view_ || !native_wrapper_.get())
+ return;
+
+ if (GetVisibleBounds().IsEmpty())
+ return;
+
+ // If the widget wasn't .e.g. minimized, hide and show would trigger
+ // PageVisibility API, enabling JS to save power while screen is locked.
+ if (visible) {
+ Layout();
+ } else {
+ native_wrapper_->HideWidget();
+ }
+}
+
bool NativeViewHost::GetNeedsNotificationWhenVisibleBoundsChange() const {
// The native widget is placed relative to the root. As such, we need to
// know when the position of any ancestor changes, or our visibility relative
« no previous file with comments | « ui/views/controls/native/native_view_host.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698