| 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_PUBLIC_APP_ACTIVITY_H_ | 5 #ifndef ATHENA_CONTENT_APP_ACTIVITY_H_ |
| 6 #define ATHENA_CONTENT_PUBLIC_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" |
| 11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 class ShellAppWindow; | 14 class ShellAppWindow; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class WebView; | 18 class WebView; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace athena { | 21 namespace athena { |
| 22 | 22 |
| 23 class AppActivityRegistry; |
| 24 |
| 25 // The activity object for a hosted V2 application. |
| 23 class AppActivity : public Activity, | 26 class AppActivity : public Activity, |
| 24 public ActivityViewModel, | 27 public ActivityViewModel, |
| 25 public content::WebContentsObserver { | 28 public content::WebContentsObserver { |
| 26 public: | 29 public: |
| 27 explicit AppActivity(extensions::ShellAppWindow* app_window); | 30 explicit AppActivity(extensions::ShellAppWindow* app_window); |
| 28 virtual ~AppActivity(); | 31 virtual ~AppActivity(); |
| 29 | 32 |
| 30 protected: | |
| 31 // Activity: | 33 // Activity: |
| 32 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; | 34 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; |
| 33 virtual void SetCurrentState(Activity::ActivityState state) OVERRIDE; | 35 virtual void SetCurrentState(Activity::ActivityState state) OVERRIDE; |
| 34 virtual ActivityState GetCurrentState() OVERRIDE; | 36 virtual ActivityState GetCurrentState() OVERRIDE; |
| 35 virtual bool IsVisible() OVERRIDE; | 37 virtual bool IsVisible() OVERRIDE; |
| 36 virtual ActivityMediaState GetMediaState() OVERRIDE; | 38 virtual ActivityMediaState GetMediaState() OVERRIDE; |
| 39 virtual aura::Window* GetWindow() OVERRIDE; |
| 37 | 40 |
| 38 // ActivityViewModel: | 41 // ActivityViewModel: |
| 39 virtual void Init() OVERRIDE; | 42 virtual void Init() OVERRIDE; |
| 40 virtual SkColor GetRepresentativeColor() const OVERRIDE; | 43 virtual SkColor GetRepresentativeColor() const OVERRIDE; |
| 41 virtual base::string16 GetTitle() const OVERRIDE; | 44 virtual base::string16 GetTitle() const OVERRIDE; |
| 42 virtual bool UsesFrame() const OVERRIDE; | 45 virtual bool UsesFrame() const OVERRIDE; |
| 43 virtual views::View* GetContentsView() OVERRIDE; | 46 virtual views::View* GetContentsView() OVERRIDE; |
| 44 virtual void CreateOverviewModeImage() OVERRIDE; | 47 virtual void CreateOverviewModeImage() OVERRIDE; |
| 45 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; | 48 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; |
| 46 | 49 |
| 50 protected: |
| 47 // content::WebContentsObserver: | 51 // content::WebContentsObserver: |
| 48 virtual void TitleWasSet(content::NavigationEntry* entry, | 52 virtual void TitleWasSet(content::NavigationEntry* entry, |
| 49 bool explicit_set) OVERRIDE; | 53 bool explicit_set) OVERRIDE; |
| 50 virtual void DidUpdateFaviconURL( | 54 virtual void DidUpdateFaviconURL( |
| 51 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 55 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
| 56 virtual void DidStartNavigationToPendingEntry( |
| 57 const GURL& url, |
| 58 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| 52 | 59 |
| 53 private: | 60 private: |
| 61 // Register this activity with its application. |
| 62 void RegisterActivity(); |
| 63 |
| 54 scoped_ptr<extensions::ShellAppWindow> app_window_; | 64 scoped_ptr<extensions::ShellAppWindow> app_window_; |
| 55 views::WebView* web_view_; | 65 views::WebView* web_view_; |
| 56 | 66 |
| 57 // The current state for this activity. | 67 // The current state for this activity. |
| 58 ActivityState current_state_; | 68 ActivityState current_state_; |
| 59 | 69 |
| 60 // The image which will be used in overview mode. | 70 // The image which will be used in overview mode. |
| 61 gfx::ImageSkia overview_mode_image_; | 71 gfx::ImageSkia overview_mode_image_; |
| 62 | 72 |
| 73 // If known the registry which holds all activities for the associated app. |
| 74 AppActivityRegistry* app_activity_registry_; |
| 75 |
| 63 DISALLOW_COPY_AND_ASSIGN(AppActivity); | 76 DISALLOW_COPY_AND_ASSIGN(AppActivity); |
| 64 }; | 77 }; |
| 65 | 78 |
| 66 } // namespace athena | 79 } // namespace athena |
| 67 | 80 |
| 68 #endif // ATHENA_CONTENT_APP_ACTIVITY_H_ | 81 #endif // ATHENA_CONTENT_APP_ACTIVITY_H_ |
| OLD | NEW |