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_WEB_ACTIVITY_H_ | 5 #ifndef ATHENA_CONTENT_PUBLIC_WEB_ACTIVITY_H_ |
6 #define ATHENA_CONTENT_PUBLIC_WEB_ACTIVITY_H_ | 6 #define ATHENA_CONTENT_PUBLIC_WEB_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 12 matching lines...) Expand all Loading... |
23 namespace athena { | 23 namespace athena { |
24 | 24 |
25 class AthenaWebView; | 25 class AthenaWebView; |
26 | 26 |
27 class WebActivity : public Activity, | 27 class WebActivity : public Activity, |
28 public ActivityViewModel, | 28 public ActivityViewModel, |
29 public content::WebContentsObserver { | 29 public content::WebContentsObserver { |
30 public: | 30 public: |
31 WebActivity(content::BrowserContext* context, const GURL& gurl); | 31 WebActivity(content::BrowserContext* context, const GURL& gurl); |
32 WebActivity(AthenaWebView* web_view); | 32 WebActivity(AthenaWebView* web_view); |
| 33 |
| 34 protected: |
33 virtual ~WebActivity(); | 35 virtual ~WebActivity(); |
34 | 36 |
35 protected: | 37 // Activity: |
36 // Activity: | |
37 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; | 38 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; |
38 virtual void SetCurrentState(ActivityState state) OVERRIDE; | 39 virtual void SetCurrentState(ActivityState state) OVERRIDE; |
39 virtual ActivityState GetCurrentState() OVERRIDE; | 40 virtual ActivityState GetCurrentState() OVERRIDE; |
40 virtual bool IsVisible() OVERRIDE; | 41 virtual bool IsVisible() OVERRIDE; |
41 virtual ActivityMediaState GetMediaState() OVERRIDE; | 42 virtual ActivityMediaState GetMediaState() OVERRIDE; |
42 virtual aura::Window* GetWindow() OVERRIDE; | 43 virtual aura::Window* GetWindow() OVERRIDE; |
43 | 44 |
44 // ActivityViewModel: | 45 // ActivityViewModel: |
45 virtual void Init() OVERRIDE; | 46 virtual void Init() OVERRIDE; |
46 virtual SkColor GetRepresentativeColor() const OVERRIDE; | 47 virtual SkColor GetRepresentativeColor() const OVERRIDE; |
47 virtual base::string16 GetTitle() const OVERRIDE; | 48 virtual base::string16 GetTitle() const OVERRIDE; |
48 virtual bool UsesFrame() const OVERRIDE; | 49 virtual bool UsesFrame() const OVERRIDE; |
49 virtual views::View* GetContentsView() OVERRIDE; | 50 virtual views::View* GetContentsView() OVERRIDE; |
50 virtual void CreateOverviewModeImage() OVERRIDE; | 51 virtual void CreateOverviewModeImage() OVERRIDE; |
51 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; | 52 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; |
52 | 53 |
53 // content::WebContentsObserver: | 54 // content::WebContentsObserver: |
54 virtual void TitleWasSet(content::NavigationEntry* entry, | 55 virtual void TitleWasSet(content::NavigationEntry* entry, |
55 bool explicit_set) OVERRIDE; | 56 bool explicit_set) OVERRIDE; |
56 virtual void DidUpdateFaviconURL( | 57 virtual void DidUpdateFaviconURL( |
57 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 58 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
58 virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE; | 59 virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE; |
59 | 60 |
60 private: | 61 private: |
| 62 // Make the content visible. This call should only be paired with |
| 63 // MakeInvisible. Note: Upon object creation the content is visible. |
| 64 void MakeVisible(); |
| 65 |
| 66 // Make the content invisible. This call should only be paired with |
| 67 // MakeVisible. |
| 68 void MakeInvisible(); |
| 69 |
| 70 // Reload the content if required, and start observing it. |
| 71 void ReloadAndObserve(); |
| 72 |
61 content::BrowserContext* browser_context_; | 73 content::BrowserContext* browser_context_; |
62 const GURL url_; | 74 const GURL url_; |
63 AthenaWebView* web_view_; | 75 AthenaWebView* web_view_; |
64 SkColor title_color_; | 76 SkColor title_color_; |
65 | 77 |
66 // The current state for this activity. | 78 // The current state for this activity. |
67 ActivityState current_state_; | 79 ActivityState current_state_; |
68 | 80 |
69 // The image which will be used in overview mode. | 81 // The image which will be used in overview mode. |
70 gfx::ImageSkia overview_mode_image_; | 82 gfx::ImageSkia overview_mode_image_; |
71 | 83 |
72 DISALLOW_COPY_AND_ASSIGN(WebActivity); | 84 DISALLOW_COPY_AND_ASSIGN(WebActivity); |
73 }; | 85 }; |
74 | 86 |
75 } // namespace athena | 87 } // namespace athena |
76 | 88 |
77 #endif // ATHENA_CONTENT_WEB_ACTIVITY_H_ | 89 #endif // ATHENA_CONTENT_WEB_ACTIVITY_H_ |
OLD | NEW |