Index: chrome/browser/ui/views/auto_keep_alive.cc |
diff --git a/chrome/browser/ui/views/auto_keep_alive.cc b/chrome/browser/ui/views/auto_keep_alive.cc |
index c7128e983f42d2d346c655574c26f50c22fbd385..8660355308681de1008a39c1d85196b2aca4d221 100644 |
--- a/chrome/browser/ui/views/auto_keep_alive.cc |
+++ b/chrome/browser/ui/views/auto_keep_alive.cc |
@@ -4,24 +4,17 @@ |
#include "chrome/browser/ui/views/auto_keep_alive.h" |
-#include "chrome/browser/lifetime/application_lifetime.h" |
+#include "chrome/browser/lifetime/scoped_keep_alive.h" |
#include "chrome/browser/ui/host_desktop.h" |
-AutoKeepAlive::AutoKeepAlive(gfx::NativeWindow window) |
- : keep_alive_available_(false) { |
- // In case of aura we want default to be keep alive not available for ash |
- // because ash has keep alive set and we don't want additional keep alive |
- // count. |
+scoped_ptr<ScopedKeepAlive> AutoKeepAlive(gfx::NativeWindow window) { |
chrome::HostDesktopType desktop_type = |
window ? chrome::GetHostDesktopTypeForNativeWindow(window) |
: chrome::GetActiveDesktop(); |
- if (desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) { |
- keep_alive_available_ = true; |
- chrome::IncrementKeepAliveCount(); |
- } |
-} |
-AutoKeepAlive::~AutoKeepAlive() { |
- if (keep_alive_available_) |
- chrome::DecrementKeepAliveCount(); |
+ scoped_ptr<ScopedKeepAlive> keep_alive; |
+ if (desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) |
+ keep_alive.reset(new ScopedKeepAlive("AutoView")); |
Bernhard Bauer
2016/02/19 17:39:28
Directly return the a new scoped_ptr here, and ret
dgn
2016/02/19 18:04:28
Done.
|
+ |
+ return keep_alive; |
} |