| 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_H_ | 5 #ifndef ATHENA_CONTENT_APP_ACTIVITY_H_ |
| 6 #define ATHENA_CONTENT_APP_ACTIVITY_H_ | 6 #define ATHENA_CONTENT_APP_ACTIVITY_H_ |
| 7 | 7 |
| 8 #include "athena/activity/public/activity.h" | 8 #include "athena/activity/public/activity.h" |
| 9 #include "athena/activity/public/activity_view_model.h" | 9 #include "athena/activity/public/activity_view_model.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace athena { | 21 namespace athena { |
| 22 | 22 |
| 23 class AppActivityRegistry; | 23 class AppActivityRegistry; |
| 24 | 24 |
| 25 // The activity object for a hosted V2 application. | 25 // The activity object for a hosted V2 application. |
| 26 class AppActivity : public Activity, | 26 class AppActivity : public Activity, |
| 27 public ActivityViewModel, | 27 public ActivityViewModel, |
| 28 public content::WebContentsObserver { | 28 public content::WebContentsObserver { |
| 29 public: | 29 public: |
| 30 explicit AppActivity(const std::string& app_id); | 30 explicit AppActivity(const std::string& app_id); |
| 31 virtual ~AppActivity(); | |
| 32 | 31 |
| 33 // Activity: | 32 // Activity: |
| 34 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; | 33 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; |
| 35 virtual void SetCurrentState(Activity::ActivityState state) OVERRIDE; | 34 virtual void SetCurrentState(Activity::ActivityState state) OVERRIDE; |
| 36 virtual ActivityState GetCurrentState() OVERRIDE; | 35 virtual ActivityState GetCurrentState() OVERRIDE; |
| 37 virtual bool IsVisible() OVERRIDE; | 36 virtual bool IsVisible() OVERRIDE; |
| 38 virtual ActivityMediaState GetMediaState() OVERRIDE; | 37 virtual ActivityMediaState GetMediaState() OVERRIDE; |
| 39 virtual aura::Window* GetWindow() OVERRIDE; | 38 virtual aura::Window* GetWindow() OVERRIDE; |
| 40 | 39 |
| 41 // ActivityViewModel: | 40 // ActivityViewModel: |
| 42 virtual void Init() OVERRIDE; | 41 virtual void Init() OVERRIDE; |
| 43 virtual SkColor GetRepresentativeColor() const OVERRIDE; | 42 virtual SkColor GetRepresentativeColor() const OVERRIDE; |
| 44 virtual base::string16 GetTitle() const OVERRIDE; | 43 virtual base::string16 GetTitle() const OVERRIDE; |
| 45 virtual bool UsesFrame() const OVERRIDE; | 44 virtual bool UsesFrame() const OVERRIDE; |
| 46 virtual views::View* GetContentsView() OVERRIDE; | 45 virtual views::View* GetContentsView() OVERRIDE; |
| 47 virtual void CreateOverviewModeImage() OVERRIDE; | 46 virtual void CreateOverviewModeImage() OVERRIDE; |
| 48 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; | 47 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; |
| 49 | 48 |
| 50 protected: | 49 protected: |
| 51 // content::WebContentsObserver: | 50 virtual ~AppActivity(); |
| 51 |
| 52 // content::WebContentsObserver: |
| 52 virtual void TitleWasSet(content::NavigationEntry* entry, | 53 virtual void TitleWasSet(content::NavigationEntry* entry, |
| 53 bool explicit_set) OVERRIDE; | 54 bool explicit_set) OVERRIDE; |
| 54 virtual void DidUpdateFaviconURL( | 55 virtual void DidUpdateFaviconURL( |
| 55 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 56 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
| 56 | 57 |
| 57 protected: | |
| 58 virtual content::WebContents* GetWebContents() = 0; | 58 virtual content::WebContents* GetWebContents() = 0; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // Register this activity with its application. | 61 // Register this activity with its application. |
| 62 void RegisterActivity(); | 62 void RegisterActivity(); |
| 63 | 63 |
| 64 // Make the content visible. This call should only be paired with |
| 65 // MakeInvisible. Note: Upon start the content is visible. |
| 66 // TODO(skuhne): If this can be combined with web_activity, move this into a |
| 67 // separate class. |
| 68 void MakeVisible(); |
| 69 |
| 70 // Make the content invisible. This call should only be paired with |
| 71 // MakeVisible. |
| 72 // TODO(skuhne): If this can be combined with web_activity, move this into a |
| 73 // separate class. |
| 74 void MakeInvisible(); |
| 75 |
| 64 const std::string app_id_; | 76 const std::string app_id_; |
| 65 | 77 |
| 66 views::WebView* web_view_; | 78 views::WebView* web_view_; |
| 67 | 79 |
| 68 // The current state for this activity. | 80 // The current state for this activity. |
| 69 ActivityState current_state_; | 81 ActivityState current_state_; |
| 70 | 82 |
| 71 // The image which will be used in overview mode. | 83 // The image which will be used in overview mode. |
| 72 gfx::ImageSkia overview_mode_image_; | 84 gfx::ImageSkia overview_mode_image_; |
| 73 | 85 |
| 74 // If known the registry which holds all activities for the associated app. | 86 // If known the registry which holds all activities for the associated app. |
| 75 // This object is owned by |AppRegistry| and will be a valid pointer as long | 87 // This object is owned by |AppRegistry| and will be a valid pointer as long |
| 76 // as this object lives. | 88 // as this object lives. |
| 77 AppActivityRegistry* app_activity_registry_; | 89 AppActivityRegistry* app_activity_registry_; |
| 78 | 90 |
| 79 DISALLOW_COPY_AND_ASSIGN(AppActivity); | 91 DISALLOW_COPY_AND_ASSIGN(AppActivity); |
| 80 }; | 92 }; |
| 81 | 93 |
| 82 } // namespace athena | 94 } // namespace athena |
| 83 | 95 |
| 84 #endif // ATHENA_CONTENT_APP_ACTIVITY_H_ | 96 #endif // ATHENA_CONTENT_APP_ACTIVITY_H_ |
| OLD | NEW |