summaryrefslogtreecommitdiffstats
path: root/extensions/browser/app_window
diff options
context:
space:
mode:
authorjackhou <jackhou@chromium.org>2015-02-15 16:38:54 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-16 00:40:05 +0000
commit39d75d5b5f11525e384745fd313d1d77ed7d0a88 (patch)
treee7538fc999a03f9b9b9842f443656478f516d9f3 /extensions/browser/app_window
parent1752909c117de5582d2751d0c467153bc30c5261 (diff)
downloadchromium_src-39d75d5b5f11525e384745fd313d1d77ed7d0a88.zip
chromium_src-39d75d5b5f11525e384745fd313d1d77ed7d0a88.tar.gz
chromium_src-39d75d5b5f11525e384745fd313d1d77ed7d0a88.tar.bz2
Hidden windows should not keep Chrome alive.
For each app window, there is a ChromeAppDelegate which holds a ScopedKeepAlive. This CL resets the ScopedKeepAlive while the app window is hidden. BUG=450710 Review URL: https://codereview.chromium.org/875273003 Cr-Commit-Position: refs/heads/master@{#316413}
Diffstat (limited to 'extensions/browser/app_window')
-rw-r--r--extensions/browser/app_window/app_delegate.h4
-rw-r--r--extensions/browser/app_window/app_window.cc2
2 files changed, 6 insertions, 0 deletions
diff --git a/extensions/browser/app_window/app_delegate.h b/extensions/browser/app_window/app_delegate.h
index 36bcc92..158b446 100644
--- a/extensions/browser/app_window/app_delegate.h
+++ b/extensions/browser/app_window/app_delegate.h
@@ -78,6 +78,10 @@ class AppDelegate {
// |callback| will be called when the process is about to terminate.
virtual void SetTerminatingCallback(const base::Closure& callback) = 0;
+
+ // Called when the app is hidden or shown.
+ virtual void OnHide() = 0;
+ virtual void OnShow() = 0;
};
} // namespace extensions
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc
index 9256228d..83f2971 100644
--- a/extensions/browser/app_window/app_window.cc
+++ b/extensions/browser/app_window/app_window.cc
@@ -660,6 +660,7 @@ void AppWindow::SetContentSizeConstraints(const gfx::Size& min_size,
}
void AppWindow::Show(ShowType show_type) {
+ app_delegate_->OnShow();
bool was_hidden = is_hidden_ || !has_been_shown_;
is_hidden_ = false;
@@ -696,6 +697,7 @@ void AppWindow::Hide() {
show_on_first_paint_ = false;
GetBaseWindow()->Hide();
AppWindowRegistry::Get(browser_context_)->AppWindowHidden(this);
+ app_delegate_->OnHide();
}
void AppWindow::SetAlwaysOnTop(bool always_on_top) {