Adding Baseframework of the ResourceManager (all hooks and observers)
[chromium-blink-merge.git] / athena / content / app_activity_proxy.cc
blobc0dbf080fe50c645f8df5a7b6a0dd25167faaee4
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"
11 namespace athena {
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() {
28 return this;
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)
35 return;
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() {
45 return false;
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 {
61 return color_;
64 base::string16 AppActivityProxy::GetTitle() const {
65 return title_;
68 bool AppActivityProxy::UsesFrame() const {
69 return true;
72 views::View* AppActivityProxy::GetContentsView() {
73 return view_;
76 void AppActivityProxy::CreateOverviewModeImage() {
77 // Nothing we can do here.
80 gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() {
81 return image_;
84 } // namespace athena