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

Unified Diff: athena/content/app_activity_proxy.cc

Issue 631333003: Adding application lifetime tests to athena, allowing to override focus request for applciations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
Index: athena/content/app_activity_proxy.cc
diff --git a/athena/content/app_activity_proxy.cc b/athena/content/app_activity_proxy.cc
index 143dd88af2c001f30f262606970a767512d2f47c..d6060a9429e5c124eaef5e6ec7ffc8fd8771ff10 100644
--- a/athena/content/app_activity_proxy.cc
+++ b/athena/content/app_activity_proxy.cc
@@ -21,7 +21,8 @@ AppActivityProxy::AppActivityProxy(AppActivity* replaced_activity,
title_(replaced_activity->GetActivityViewModel()->GetTitle()),
color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()),
replaced_activity_(replaced_activity),
- view_(new views::View()) {
+ view_(new views::View()),
+ restart_called_(false) {
}
AppActivityProxy::~AppActivityProxy() {
@@ -33,9 +34,11 @@ ActivityViewModel* AppActivityProxy::GetActivityViewModel() {
}
void AppActivityProxy::SetCurrentState(ActivityState state) {
- // We only restart the application when we are switching to visible.
- if (state != ACTIVITY_VISIBLE)
+ // We only restart the application when we are switching to visible, and only
+ // once.
+ if (state != ACTIVITY_VISIBLE || restart_called_)
return;
+ restart_called_ = true;
app_activity_registry_->RestartApplication(this);
// Note: This object is now destroyed.
}

Powered by Google App Engine
This is Rietveld 408576698