#include "ui/aura/window.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
-#include "ui/wm/core/window_util.h"
namespace athena {
title_(replaced_activity->GetActivityViewModel()->GetTitle()),
color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()),
replaced_activity_(replaced_activity),
- view_(new views::View()) {
-}
-
-AppActivityProxy::~AppActivityProxy() {
- app_activity_registry_->ProxyDestroyed(this);
+ view_(new views::View()),
+ restart_called_(false) {
}
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.
}
}
aura::Window* AppActivityProxy::GetWindow() {
- return view_->GetWidget()->GetNativeWindow();
+ return view_->GetWidget() ? view_->GetWidget()->GetNativeWindow() : nullptr;
}
content::WebContents* AppActivityProxy::GetWebContents() {
- return NULL;
+ return nullptr;
}
void AppActivityProxy::Init() {
WindowManager::Get()->GetWindowListProvider();
window_list_provider->StackWindowBehindTo(GetWindow(),
replaced_activity_->GetWindow());
- // Creating this object was moving the activation to this window which should
- // not be the active window. As such we re-activate the top activity window.
- // TODO(skuhne): This should possibly move to the WindowListProvider.
- wm::ActivateWindow(window_list_provider->GetWindowList().back());
// After the Init() function returns, the passed |replaced_activity_| might
// get destroyed. Since we do not need it anymore we reset it.
- replaced_activity_ = NULL;
+ replaced_activity_ = nullptr;
}
SkColor AppActivityProxy::GetRepresentativeColor() const {
return gfx::ImageSkia();
}
+void AppActivityProxy::SetActivityView(ActivityView* view) {
+}
+
bool AppActivityProxy::UsesFrame() const {
return true;
}
return view_;
}
-views::Widget* AppActivityProxy::CreateWidget() {
- return NULL;
-}
-
gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() {
return content_proxy_->GetContentImage();
}
void AppActivityProxy::ResetContentsView() {
}
+AppActivityProxy::~AppActivityProxy() {
+ app_activity_registry_->ProxyDestroyed(this);
+}
+
} // namespace athena