OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "athena/content/app_activity_proxy.h" |
| 6 |
| 7 #include "athena/content/app_activity_registry.h" |
| 8 #include "ui/views/view.h" |
| 9 #include "ui/views/widget/widget.h" |
| 10 |
| 11 namespace athena { |
| 12 |
| 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()) {} |
| 22 |
| 23 AppActivityProxy::~AppActivityProxy() { |
| 24 app_activity_registry_->ProxyDestroyed(this); |
| 25 } |
| 26 |
| 27 ActivityViewModel* AppActivityProxy::GetActivityViewModel() { |
| 28 return this; |
| 29 } |
| 30 |
| 31 void AppActivityProxy::SetCurrentState(ActivityState state) { |
| 32 // We ignore all calls which try to re-load the application at a lower then |
| 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. |
| 38 } |
| 39 |
| 40 Activity::ActivityState AppActivityProxy::GetCurrentState() { |
| 41 return ACTIVITY_UNLOADED; |
| 42 } |
| 43 |
| 44 bool AppActivityProxy::IsVisible() { |
| 45 // This proxy is never visible. |
| 46 return false; |
| 47 } |
| 48 |
| 49 Activity::ActivityMediaState AppActivityProxy::GetMediaState() { |
| 50 // This proxy has never any media playing. |
| 51 return ACTIVITY_MEDIA_STATE_NONE; |
| 52 } |
| 53 |
| 54 aura::Window* AppActivityProxy::GetWindow() { |
| 55 return view_->GetWidget()->GetNativeWindow(); |
| 56 } |
| 57 |
| 58 void AppActivityProxy::Init() { |
| 59 } |
| 60 |
| 61 SkColor AppActivityProxy::GetRepresentativeColor() const { |
| 62 return color_; |
| 63 } |
| 64 |
| 65 base::string16 AppActivityProxy::GetTitle() const { |
| 66 return title_; |
| 67 } |
| 68 |
| 69 bool AppActivityProxy::UsesFrame() const { |
| 70 return false; |
| 71 } |
| 72 |
| 73 views::View* AppActivityProxy::GetContentsView() { |
| 74 return view_; |
| 75 } |
| 76 |
| 77 void AppActivityProxy::CreateOverviewModeImage() { |
| 78 // Nothing we can do here. |
| 79 } |
| 80 |
| 81 gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() { |
| 82 return image_; |
| 83 } |
| 84 |
| 85 } // namespace athena |
OLD | NEW |