| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "athena/content/app_activity_proxy.h" | 5 #include "athena/content/app_activity_proxy.h" |
| 6 | 6 |
| 7 #include "athena/content/app_activity.h" | 7 #include "athena/content/app_activity.h" |
| 8 #include "athena/content/app_activity_registry.h" | 8 #include "athena/content/app_activity_registry.h" |
| 9 #include "athena/wm/public/window_list_provider.h" | 9 #include "athena/wm/public/window_list_provider.h" |
| 10 #include "athena/wm/public/window_manager.h" | 10 #include "athena/wm/public/window_manager.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 14 #include "ui/wm/core/window_util.h" | 14 #include "ui/wm/core/window_util.h" |
| 15 | 15 |
| 16 namespace athena { | 16 namespace athena { |
| 17 | 17 |
| 18 AppActivityProxy::AppActivityProxy(AppActivity* replaced_activity, | 18 AppActivityProxy::AppActivityProxy(AppActivity* replaced_activity, |
| 19 AppActivityRegistry* creator) : | 19 AppActivityRegistry* creator) : |
| 20 app_activity_registry_(creator), | 20 app_activity_registry_(creator), |
| 21 title_(replaced_activity->GetActivityViewModel()->GetTitle()), | 21 title_(replaced_activity->GetActivityViewModel()->GetTitle()), |
| 22 color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()), | 22 color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()), |
| 23 replaced_activity_(replaced_activity), | 23 replaced_activity_(replaced_activity), |
| 24 view_(new views::View()) { | 24 view_(new views::View()), |
| 25 restart_called_(false) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 AppActivityProxy::~AppActivityProxy() { | 28 AppActivityProxy::~AppActivityProxy() { |
| 28 app_activity_registry_->ProxyDestroyed(this); | 29 app_activity_registry_->ProxyDestroyed(this); |
| 29 } | 30 } |
| 30 | 31 |
| 31 ActivityViewModel* AppActivityProxy::GetActivityViewModel() { | 32 ActivityViewModel* AppActivityProxy::GetActivityViewModel() { |
| 32 return this; | 33 return this; |
| 33 } | 34 } |
| 34 | 35 |
| 35 void AppActivityProxy::SetCurrentState(ActivityState state) { | 36 void AppActivityProxy::SetCurrentState(ActivityState state) { |
| 36 // We only restart the application when we are switching to visible. | 37 // We only restart the application when we are switching to visible, and only |
| 37 if (state != ACTIVITY_VISIBLE) | 38 // once. |
| 39 if (state != ACTIVITY_VISIBLE || restart_called_) |
| 38 return; | 40 return; |
| 41 restart_called_ = true; |
| 39 app_activity_registry_->RestartApplication(this); | 42 app_activity_registry_->RestartApplication(this); |
| 40 // Note: This object is now destroyed. | 43 // Note: This object is now destroyed. |
| 41 } | 44 } |
| 42 | 45 |
| 43 Activity::ActivityState AppActivityProxy::GetCurrentState() { | 46 Activity::ActivityState AppActivityProxy::GetCurrentState() { |
| 44 return ACTIVITY_UNLOADED; | 47 return ACTIVITY_UNLOADED; |
| 45 } | 48 } |
| 46 | 49 |
| 47 bool AppActivityProxy::IsVisible() { | 50 bool AppActivityProxy::IsVisible() { |
| 48 return false; | 51 return false; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return content_proxy_->GetContentImage(); | 109 return content_proxy_->GetContentImage(); |
| 107 } | 110 } |
| 108 | 111 |
| 109 void AppActivityProxy::PrepareContentsForOverview() { | 112 void AppActivityProxy::PrepareContentsForOverview() { |
| 110 } | 113 } |
| 111 | 114 |
| 112 void AppActivityProxy::ResetContentsView() { | 115 void AppActivityProxy::ResetContentsView() { |
| 113 } | 116 } |
| 114 | 117 |
| 115 } // namespace athena | 118 } // namespace athena |
| OLD | NEW |