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