Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / athena / test / sample_activity.cc
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/test/sample_activity.h"
6
7 #include "ui/gfx/image/image_skia.h"
8 #include "ui/views/background.h"
9 #include "ui/views/view.h"
10 #include "ui/views/widget/widget.h"
11
12 namespace athena {
13 namespace test {
14
15 SampleActivity::SampleActivity(SkColor color,
16                                SkColor contents_color,
17                                const base::string16& title)
18     : color_(color),
19       contents_color_(contents_color),
20       title_(title),
21       contents_view_(NULL),
22       current_state_(ACTIVITY_UNLOADED) {
23 }
24
25 SampleActivity::~SampleActivity() {
26 }
27
28 athena::ActivityViewModel* SampleActivity::GetActivityViewModel() {
29   return this;
30 }
31
32 void SampleActivity::SetCurrentState(Activity::ActivityState state) {
33   current_state_ = state;
34 }
35
36 Activity::ActivityState SampleActivity::GetCurrentState() {
37   return current_state_;
38 }
39
40 bool SampleActivity::IsVisible() {
41   return contents_view_ && contents_view_->IsDrawn();
42 }
43
44 Activity::ActivityMediaState SampleActivity::GetMediaState() {
45   return Activity::ACTIVITY_MEDIA_STATE_NONE;
46 }
47
48 aura::Window* SampleActivity::GetWindow() {
49   return !contents_view_ ? NULL
50                          : contents_view_->GetWidget()->GetNativeWindow();
51 }
52
53 content::WebContents* SampleActivity::GetWebContents() {
54   return NULL;
55 }
56
57 void SampleActivity::Init() {
58 }
59
60 SkColor SampleActivity::GetRepresentativeColor() const {
61   return color_;
62 }
63
64 base::string16 SampleActivity::GetTitle() const {
65   return title_;
66 }
67
68 gfx::ImageSkia SampleActivity::GetIcon() const {
69   return gfx::ImageSkia();
70 }
71
72 bool SampleActivity::UsesFrame() const {
73   return true;
74 }
75
76 views::View* SampleActivity::GetContentsView() {
77   if (!contents_view_) {
78     contents_view_ = new views::View;
79     contents_view_->set_background(
80         views::Background::CreateSolidBackground(contents_color_));
81   }
82   return contents_view_;
83 }
84
85 views::Widget* SampleActivity::CreateWidget() {
86   return NULL;
87 }
88
89 gfx::ImageSkia SampleActivity::GetOverviewModeImage() {
90   return gfx::ImageSkia();
91 }
92
93 void SampleActivity::PrepareContentsForOverview() {
94 }
95
96 void SampleActivity::ResetContentsView() {
97 }
98
99 }  // namespace test
100 }  // namespace athena