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_ACTIVITY_PUBLIC_ACTIVITY_H_ | 5 #ifndef ATHENA_ACTIVITY_PUBLIC_ACTIVITY_H_ |
6 #define ATHENA_ACTIVITY_PUBLIC_ACTIVITY_H_ | 6 #define ATHENA_ACTIVITY_PUBLIC_ACTIVITY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "athena/athena_export.h" | 10 #include "athena/athena_export.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // deciding if an activity can put into a lower state then |ACTIVITY_INVISIBLE|. | 31 // deciding if an activity can put into a lower state then |ACTIVITY_INVISIBLE|. |
32 class ATHENA_EXPORT Activity { | 32 class ATHENA_EXPORT Activity { |
33 public: | 33 public: |
34 // The state of an activity which could either be set or requested by e.g. the | 34 // The state of an activity which could either be set or requested by e.g. the |
35 // resource management system. | 35 // resource management system. |
36 enum ActivityState { | 36 enum ActivityState { |
37 // The activity is allowed to have gpu compositor layers and can be visible. | 37 // The activity is allowed to have gpu compositor layers and can be visible. |
38 ACTIVITY_VISIBLE, | 38 ACTIVITY_VISIBLE, |
39 // The activity does not have gpu compositing layers, will not be visible | 39 // The activity does not have gpu compositing layers, will not be visible |
40 // and will be treated as a background priority task. | 40 // and will be treated as a background priority task. |
| 41 // By transitioning from VISIBLE to INVISIBLE, a screen shot of the current |
| 42 // web content will be taken and replaces the "active content". |
41 ACTIVITY_INVISIBLE, | 43 ACTIVITY_INVISIBLE, |
42 // The activity should surrender additional resources. This has only an | 44 // The activity should surrender additional resources. This has only an |
43 // effect when the activity is in a loaded state (Visible, Active, Hidden). | 45 // effect when the activity is in a loaded state (Visible, Active, Hidden). |
44 ACTIVITY_BACKGROUND_LOW_PRIORITY, | 46 ACTIVITY_BACKGROUND_LOW_PRIORITY, |
45 // The activity will only keep a minimum set of resources to get back to the | 47 // The activity will only keep a minimum set of resources to get back to the |
46 // running state. It will get stalled however. Note that it is not possible | 48 // running state. It will get stalled however. Note that it is not possible |
47 // to get into this state from the |ACTIVITY_UNLOADED| state. | 49 // to get into this state from the |ACTIVITY_UNLOADED| state. |
48 ACTIVITY_PERSISTENT, | 50 ACTIVITY_PERSISTENT, |
49 // Unloads the activity and can be called in any state - but unloaded. | 51 // Unloads the activity and can be called in any state - but unloaded. |
50 ACTIVITY_UNLOADED | 52 ACTIVITY_UNLOADED |
51 }; | 53 }; |
52 | 54 |
53 // This enum declares the media state the activity is in. | 55 // This enum declares the media state the activity is in. |
54 // TODO(skuhne): Move the |TabMediaState| out of chrome and combine it in a | 56 // TODO(skuhne): Move the |TabMediaState| out of chrome and combine it in a |
55 // media library within content and then use that enum instead. | 57 // media library within content and then use that enum instead. |
56 enum ActivityMediaState { | 58 enum ActivityMediaState { |
57 ACTIVITY_MEDIA_STATE_NONE, | 59 ACTIVITY_MEDIA_STATE_NONE, |
58 ACTIVITY_MEDIA_STATE_RECORDING, // Audio/Video being recorded by activity. | 60 ACTIVITY_MEDIA_STATE_RECORDING, // Audio/Video being recorded by activity. |
59 ACTIVITY_MEDIA_STATE_CAPTURING, // Activity is being captured. | 61 ACTIVITY_MEDIA_STATE_CAPTURING, // Activity is being captured. |
60 ACTIVITY_MEDIA_STATE_AUDIO_PLAYING // Audible audio is playing in activity. | 62 ACTIVITY_MEDIA_STATE_AUDIO_PLAYING // Audible audio is playing in activity. |
61 }; | 63 }; |
62 | 64 |
63 virtual ~Activity(); | 65 // Delete an activity. |
| 66 static void Delete(Activity* activity); |
64 | 67 |
65 // The Activity retains ownership of the returned view-model. | 68 // The Activity retains ownership of the returned view-model. |
66 virtual ActivityViewModel* GetActivityViewModel() = 0; | 69 virtual ActivityViewModel* GetActivityViewModel() = 0; |
67 | 70 |
68 // Transition the activity into a new state. | 71 // Transition the activity into a new state. |
69 virtual void SetCurrentState(ActivityState state) = 0; | 72 virtual void SetCurrentState(ActivityState state) = 0; |
70 | 73 |
71 // Returns the current state of the activity. | 74 // Returns the current state of the activity. |
72 virtual ActivityState GetCurrentState() = 0; | 75 virtual ActivityState GetCurrentState() = 0; |
73 | 76 |
74 // Returns if the activity is visible or not. | 77 // Returns if the activity is visible or not. |
75 virtual bool IsVisible() = 0; | 78 virtual bool IsVisible() = 0; |
76 | 79 |
77 // Returns the current media state. | 80 // Returns the current media state. |
78 virtual ActivityMediaState GetMediaState() = 0; | 81 virtual ActivityMediaState GetMediaState() = 0; |
79 | 82 |
80 // Returns the window for the activity. This can be used to determine the | 83 // Returns the window for the activity. This can be used to determine the |
81 // stacking order of this activity against others. | 84 // stacking order of this activity against others. |
82 virtual aura::Window* GetWindow() = 0; | 85 virtual aura::Window* GetWindow() = 0; |
| 86 |
| 87 protected: |
| 88 virtual ~Activity() {} |
83 }; | 89 }; |
84 | 90 |
85 } // namespace athena | 91 } // namespace athena |
86 | 92 |
87 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_H_ | 93 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_H_ |
OLD | NEW |