OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ATHENA_CONTENT_APP_ACTIVITY_PROXY_H_ | 5 #ifndef ATHENA_CONTENT_APP_ACTIVITY_PROXY_H_ |
6 #define ATHENA_CONTENT_APP_ACTIVITY_PROXY_H_ | 6 #define ATHENA_CONTENT_APP_ACTIVITY_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "athena/activity/public/activity.h" | 10 #include "athena/activity/public/activity.h" |
11 #include "athena/activity/public/activity_view_model.h" | 11 #include "athena/activity/public/activity_view_model.h" |
| 12 #include "athena/content/content_proxy.h" |
| 13 #include "base/memory/scoped_ptr.h" |
12 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
13 | 15 |
14 namespace athena { | 16 namespace athena { |
15 | 17 |
| 18 class AppActivity; |
16 class AppActivityRegistry; | 19 class AppActivityRegistry; |
17 | 20 |
18 // This activity object is a proxy placeholder for the application while it is | 21 // This activity object is a proxy placeholder for the application while it is |
19 // unloaded. When selected it will launch the applciation again and destroy | 22 // unloaded. When selected it will launch the applciation again and destroy |
20 // itself indirectly. | 23 // itself indirectly. |
21 class AppActivityProxy : public Activity, | 24 class AppActivityProxy : public Activity, |
22 public ActivityViewModel { | 25 public ActivityViewModel { |
23 public: | 26 public: |
24 // The |replaced_activity| is the activity which this proxy replaces. Note | 27 // The |replaced_activity| is the activity which this proxy replaces. Note |
25 // that after the Init() call got called, this object will become invalid. | 28 // that after the Init() call got called, this object will become invalid. |
26 // The |creator| should be informed when the object goes away. | 29 // The |creator| should be informed when the object goes away. |
27 AppActivityProxy(Activity* replaced_activity, AppActivityRegistry* creator); | 30 AppActivityProxy(AppActivity* replaced_activity, |
| 31 AppActivityRegistry* creator); |
28 | 32 |
29 protected: | 33 protected: |
30 virtual ~AppActivityProxy(); | 34 virtual ~AppActivityProxy(); |
31 | 35 |
32 // Activity overrides: | 36 // Activity overrides: |
33 virtual ActivityViewModel* GetActivityViewModel() OVERRIDE; | 37 virtual ActivityViewModel* GetActivityViewModel() OVERRIDE; |
34 virtual void SetCurrentState(ActivityState state) OVERRIDE; | 38 virtual void SetCurrentState(ActivityState state) OVERRIDE; |
35 virtual ActivityState GetCurrentState() OVERRIDE; | 39 virtual ActivityState GetCurrentState() OVERRIDE; |
36 virtual bool IsVisible() OVERRIDE; | 40 virtual bool IsVisible() OVERRIDE; |
37 virtual ActivityMediaState GetMediaState() OVERRIDE; | 41 virtual ActivityMediaState GetMediaState() OVERRIDE; |
38 virtual aura::Window* GetWindow() OVERRIDE; | 42 virtual aura::Window* GetWindow() OVERRIDE; |
39 | 43 |
40 // ActivityViewModel overrides: | 44 // ActivityViewModel overrides: |
41 virtual void Init() OVERRIDE; | 45 virtual void Init() OVERRIDE; |
42 virtual SkColor GetRepresentativeColor() const OVERRIDE; | 46 virtual SkColor GetRepresentativeColor() const OVERRIDE; |
43 virtual base::string16 GetTitle() const OVERRIDE; | 47 virtual base::string16 GetTitle() const OVERRIDE; |
44 virtual bool UsesFrame() const OVERRIDE; | 48 virtual bool UsesFrame() const OVERRIDE; |
45 virtual views::View* GetContentsView() OVERRIDE; | 49 virtual views::View* GetContentsView() OVERRIDE; |
46 virtual void CreateOverviewModeImage() OVERRIDE; | |
47 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; | 50 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; |
48 virtual void PrepareContentsForOverview() OVERRIDE; | 51 virtual void PrepareContentsForOverview() OVERRIDE; |
49 virtual void ResetContentsView() OVERRIDE; | 52 virtual void ResetContentsView() OVERRIDE; |
50 | 53 |
51 private: | 54 private: |
52 // The creator of this object which needs to be informed if the object gets | 55 // The creator of this object which needs to be informed if the object gets |
53 // destroyed or the application should get restarted. | 56 // destroyed or the application should get restarted. |
54 AppActivityRegistry* app_activity_registry_; | 57 AppActivityRegistry* app_activity_registry_; |
55 | 58 |
56 // The presentation values. | 59 // The presentation values. |
57 const base::string16 title_; | 60 const base::string16 title_; |
58 const gfx::ImageSkia image_; | |
59 const SkColor color_; | 61 const SkColor color_; |
60 | 62 |
61 // The activity which gets replaced. It is used to sort the activity against | 63 // The activity which gets replaced. It is used to sort the activity against |
62 // upon initialization. Once moved, this value gets reset since the object | 64 // upon initialization. Once moved, this value gets reset since the object |
63 // can go away at any time. | 65 // can go away at any time. |
64 Activity* replaced_activity_; | 66 AppActivity* replaced_activity_; |
65 | 67 |
66 // The associated view. | 68 // The associated view. |
67 views::View* view_; | 69 views::View* view_; |
68 | 70 |
| 71 // The content proxy. |
| 72 scoped_ptr<ContentProxy> content_proxy_; |
| 73 |
69 DISALLOW_COPY_AND_ASSIGN(AppActivityProxy); | 74 DISALLOW_COPY_AND_ASSIGN(AppActivityProxy); |
70 }; | 75 }; |
71 | 76 |
72 } // namespace athena | 77 } // namespace athena |
73 | 78 |
74 #endif // ATHENA_CONTENT_APP_ACTIVITY_PROXY_H_ | 79 #endif // ATHENA_CONTENT_APP_ACTIVITY_PROXY_H_ |
OLD | NEW |