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
3 // found in the LICENSE file.
5 #include "athena/content/app_activity_proxy.h"
7 #include "athena/content/app_activity_registry.h"
8 #include "ui/views/view.h"
9 #include "ui/views/widget/widget.h"
13 AppActivityProxy::AppActivityProxy(ActivityViewModel
* view_model
,
14 AppActivityRegistry
* creator
) :
15 app_activity_registry_(creator
),
16 title_(view_model
->GetTitle()),
17 image_(view_model
->GetOverviewModeImage()),
18 color_(view_model
->GetRepresentativeColor()),
19 // TODO(skuhne): We probably need to do something better with the view
20 // (e.g. showing the image).
21 view_(new views::View()) {}
23 AppActivityProxy::~AppActivityProxy() {
24 app_activity_registry_
->ProxyDestroyed(this);
27 ActivityViewModel
* AppActivityProxy::GetActivityViewModel() {
31 void AppActivityProxy::SetCurrentState(ActivityState state
) {
32 // We ignore all calls which try to re-load the application at a lower than
33 // running invisible state.
34 if (state
!= ACTIVITY_VISIBLE
&& state
!= ACTIVITY_INVISIBLE
)
36 app_activity_registry_
->RestartApplication(this);
37 // Note: This object is now destroyed.
40 Activity::ActivityState
AppActivityProxy::GetCurrentState() {
41 return ACTIVITY_UNLOADED
;
44 bool AppActivityProxy::IsVisible() {
48 Activity::ActivityMediaState
AppActivityProxy::GetMediaState() {
49 // This proxy has never any media playing.
50 return ACTIVITY_MEDIA_STATE_NONE
;
53 aura::Window
* AppActivityProxy::GetWindow() {
54 return view_
->GetWidget()->GetNativeWindow();
57 void AppActivityProxy::Init() {
60 SkColor
AppActivityProxy::GetRepresentativeColor() const {
64 base::string16
AppActivityProxy::GetTitle() const {
68 bool AppActivityProxy::UsesFrame() const {
72 views::View
* AppActivityProxy::GetContentsView() {
76 void AppActivityProxy::CreateOverviewModeImage() {
77 // Nothing we can do here.
80 gfx::ImageSkia
AppActivityProxy::GetOverviewModeImage() {