Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / ui / views / auto_keep_alive.cc
blobf1443cd377796921ee15245c7e57c104ff72ee0a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/auto_keep_alive.h"
7 #include "chrome/browser/lifetime/application_lifetime.h"
9 #if defined(USE_AURA)
10 #include "ui/aura/window.h"
11 #include "ui/views/view_constants_aura.h"
12 #endif
14 AutoKeepAlive::AutoKeepAlive(gfx::NativeWindow window)
15 : keep_alive_available_(true) {
16 #if defined(USE_AURA)
17 // In case of aura we want default to be keep alive not available.
18 keep_alive_available_ = false;
19 if (window) {
20 gfx::NativeWindow native_window = window->GetRootWindow();
21 if (native_window->GetProperty(views::kDesktopRootWindow))
22 keep_alive_available_ = true;
24 #endif
25 if (keep_alive_available_)
26 chrome::IncrementKeepAliveCount();
29 AutoKeepAlive::~AutoKeepAlive() {
30 if (keep_alive_available_)
31 chrome::DecrementKeepAliveCount();