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