| 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 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. | |
| 38 } | |
| 39 | |
| 40 Activity::ActivityState AppActivityProxy::GetCurrentState() { | |
| 41 return ACTIVITY_UNLOADED; | |
| 42 } | |
| 43 | |
| 44 bool AppActivityProxy::IsVisible() { | |
| 45 return true; | |
| 46 } | |
| 47 | |
| 48 Activity::ActivityMediaState AppActivityProxy::GetMediaState() { | |
| 49 // This proxy has never any media playing. | |
| 50 return ACTIVITY_MEDIA_STATE_NONE; | |
| 51 } | |
| 52 | |
| 53 aura::Window* AppActivityProxy::GetWindow() { | |
| 54 return view_->GetWidget()->GetNativeWindow(); | |
| 55 } | |
| 56 | |
| 57 void AppActivityProxy::Init() { | |
| 58 } | |
| 59 | |
| 60 SkColor AppActivityProxy::GetRepresentativeColor() const { | |
| 61 return color_; | |
| 62 } | |
| 63 | |
| 64 base::string16 AppActivityProxy::GetTitle() const { | |
| 65 return title_; | |
| 66 } | |
| 67 | |
| 68 bool AppActivityProxy::UsesFrame() const { | |
| 69 return true; | |
| 70 } | |
| 71 | |
| 72 views::View* AppActivityProxy::GetContentsView() { | |
| 73 return view_; | |
| 74 } | |
| 75 | |
| 76 void AppActivityProxy::CreateOverviewModeImage() { | |
| 77 // Nothing we can do here. | |
| 78 } | |
| 79 | |
| 80 gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() { | |
| 81 return image_; | |
| 82 } | |
| 83 | |
| 84 } // namespace athena | |
| OLD | NEW |