forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Athena: Adding basic resource management framework (un-/re-loading) o…
…f V2 applications Functionality: The |AppRegistry| has for each running application an |AppActivityRegistry|. The |AppActivityRegistry| knows all activities associated with the application it represents. It can furthermore shut the app entirely down upon resource manager request. It will then create an |AppActivityProxy| for the overview mode which shows a placeholder for an unloaded app. This placeholder can then ask the |AppActivityRegistry| to restart the application again. A shutdown request for the application is only performed when all activities were marked for UNLOAD. If there were multiple activities upon shutdown for one app, the app has to take care of re-creating all windows and thus re-creating all activities. Since an activity match cannot be performed, the |AppActivityProxy| will only be shown once and it will show in the location of the most recently used activity of that app. If we later on find an app which really uses multiple windows and it is imperative to keep the history for all of them tact & the app is recreating them properly, (a lot of if's) we can revisit the single |AppActivityProxy| and try to address it in a cleaner way, but at this time that seems rather un-useful since it is not known if required. BUG=388085 TEST=AppActivityTest.* Review URL: https://codereview.chromium.org/477523002 Cr-Commit-Position: refs/heads/master@{#291221} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291221 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
skuhne@chromium.org
committed
Aug 21, 2014
1 parent
65582b3
commit 23e145e
Showing
22 changed files
with
1,287 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
skuhne@chromium.org | ||
oshima@chromium.org | ||
mukai@chromium.org | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "athena/content/app_activity_proxy.h" | ||
|
||
#include "athena/content/app_activity_registry.h" | ||
#include "ui/views/view.h" | ||
#include "ui/views/widget/widget.h" | ||
|
||
namespace athena { | ||
|
||
AppActivityProxy::AppActivityProxy(ActivityViewModel* view_model, | ||
AppActivityRegistry* creator) : | ||
app_activity_registry_(creator), | ||
title_(view_model->GetTitle()), | ||
image_(view_model->GetOverviewModeImage()), | ||
color_(view_model->GetRepresentativeColor()), | ||
// TODO(skuhne): We probably need to do something better with the view | ||
// (e.g. showing the image). | ||
view_(new views::View()) {} | ||
|
||
AppActivityProxy::~AppActivityProxy() { | ||
app_activity_registry_->ProxyDestroyed(this); | ||
} | ||
|
||
ActivityViewModel* AppActivityProxy::GetActivityViewModel() { | ||
return this; | ||
} | ||
|
||
void AppActivityProxy::SetCurrentState(ActivityState state) { | ||
// We ignore all calls which try to re-load the application at a lower than | ||
// running invisible state. | ||
if (state != ACTIVITY_VISIBLE && state != ACTIVITY_INVISIBLE) | ||
return; | ||
app_activity_registry_->RestartApplication(this); | ||
// Note: This object is now destroyed. | ||
} | ||
|
||
Activity::ActivityState AppActivityProxy::GetCurrentState() { | ||
return ACTIVITY_UNLOADED; | ||
} | ||
|
||
bool AppActivityProxy::IsVisible() { | ||
return true; | ||
} | ||
|
||
Activity::ActivityMediaState AppActivityProxy::GetMediaState() { | ||
// This proxy has never any media playing. | ||
return ACTIVITY_MEDIA_STATE_NONE; | ||
} | ||
|
||
aura::Window* AppActivityProxy::GetWindow() { | ||
return view_->GetWidget()->GetNativeWindow(); | ||
} | ||
|
||
void AppActivityProxy::Init() { | ||
} | ||
|
||
SkColor AppActivityProxy::GetRepresentativeColor() const { | ||
return color_; | ||
} | ||
|
||
base::string16 AppActivityProxy::GetTitle() const { | ||
return title_; | ||
} | ||
|
||
bool AppActivityProxy::UsesFrame() const { | ||
return true; | ||
} | ||
|
||
views::View* AppActivityProxy::GetContentsView() { | ||
return view_; | ||
} | ||
|
||
void AppActivityProxy::CreateOverviewModeImage() { | ||
// Nothing we can do here. | ||
} | ||
|
||
gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() { | ||
return image_; | ||
} | ||
|
||
} // namespace athena |
Oops, something went wrong.