Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/native/native_view_host_aura.h" | 5 #include "ui/views/controls/native/native_view_host_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/client/focus_client.h" | 8 #include "ui/aura/client/focus_client.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/base/cursor/cursor.h" | 10 #include "ui/base/cursor/cursor.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 if (host_->native_view()) | 105 if (host_->native_view()) |
| 106 return host_->native_view()->GetCursor(gfx::Point(x, y)); | 106 return host_->native_view()->GetCursor(gfx::Point(x, y)); |
| 107 return gfx::kNullCursor; | 107 return gfx::kNullCursor; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void NativeViewHostAura::OnWindowDestroyed(aura::Window* window) { | 110 void NativeViewHostAura::OnWindowDestroyed(aura::Window* window) { |
| 111 DCHECK(window == host_->native_view()); | 111 DCHECK(window == host_->native_view()); |
| 112 host_->NativeViewDestroyed(); | 112 host_->NativeViewDestroyed(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void NativeViewHostAura::OnWindowVisibilityChanged(aura::Window* window, | |
|
sky
2014/05/15 22:42:19
Again, I think this should be done at the content
| |
| 116 bool is_visible) { | |
| 117 // To reduce background activity of minimized / non visible browser content, | |
| 118 // we let the native view follow its parent's visibility which will suppress | |
| 119 // further renderer updates. | |
| 120 // Note: In case of browser navigations, the window visibility will change to | |
| 121 // invisible as well and cause long "flashes". By following the parent's | |
| 122 // windows visibility, we only suppress rendering in case of minimizing / | |
| 123 // general invisibility. | |
| 124 if (host_->native_view() && | |
| 125 host_->native_view()->parent() && | |
| 126 is_visible == host_->native_view()->parent()->IsVisible()) { | |
| 127 if (is_visible) | |
| 128 host_->native_view()->Show(); | |
| 129 else | |
| 130 host_->native_view()->Hide(); | |
| 131 } | |
| 132 } | |
| 133 | |
| 115 // static | 134 // static |
| 116 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( | 135 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( |
| 117 NativeViewHost* host) { | 136 NativeViewHost* host) { |
| 118 return new NativeViewHostAura(host); | 137 return new NativeViewHostAura(host); |
| 119 } | 138 } |
| 120 | 139 |
| 121 } // namespace views | 140 } // namespace views |
| OLD | NEW |