Additions to Activities to allow resource management
[chromium-blink-merge.git] / athena / test / sample_activity.cc
blob6c4c06486c909c1e9be71a5f80edd106c4a38b51
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/test/sample_activity.h"
7 #include "ui/views/background.h"
8 #include "ui/views/view.h"
10 namespace athena {
11 namespace test {
13 SampleActivity::SampleActivity(SkColor color,
14 SkColor contents_color,
15 const base::string16& title)
16 : color_(color),
17 contents_color_(contents_color),
18 title_(title),
19 contents_view_(NULL),
20 current_state_(ACTIVITY_UNLOADED) {
23 SampleActivity::~SampleActivity() {
26 athena::ActivityViewModel* SampleActivity::GetActivityViewModel() {
27 return this;
30 void SampleActivity::SetCurrentState(Activity::ActivityState state) {
31 current_state_ = state;
34 Activity::ActivityState SampleActivity::GetCurrentState() {
35 return current_state_;
38 bool SampleActivity::IsVisible() {
39 return contents_view_ && contents_view_->IsDrawn();
42 Activity::ActivityMediaState SampleActivity::GetMediaState() {
43 return Activity::ACTIVITY_MEDIA_STATE_NONE;
46 void SampleActivity::Init() {
49 SkColor SampleActivity::GetRepresentativeColor() const {
50 return color_;
53 base::string16 SampleActivity::GetTitle() const {
54 return title_;
57 bool SampleActivity::UsesFrame() const {
58 return true;
61 views::View* SampleActivity::GetContentsView() {
62 if (!contents_view_) {
63 contents_view_ = new views::View;
64 contents_view_->set_background(
65 views::Background::CreateSolidBackground(contents_color_));
67 return contents_view_;
70 void SampleActivity::CreateOverviewModeImage() {
73 gfx::ImageSkia SampleActivity::GetOverviewModeImage() {
74 return gfx::ImageSkia();
77 } // namespace test
78 } // namespace athena