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 <vector> |
| 9 |
8 #include "athena/activity/public/activity.h" | 10 #include "athena/activity/public/activity.h" |
9 #include "athena/activity/public/activity_view_model.h" | 11 #include "athena/activity/public/activity_view_model.h" |
10 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
11 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
12 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
13 | 15 |
| 16 class SkBitmap; |
| 17 |
14 namespace content { | 18 namespace content { |
15 class BrowserContext; | 19 class BrowserContext; |
16 class WebContents; | 20 class WebContents; |
17 } | 21 } |
18 | 22 |
| 23 namespace gfx { |
| 24 class Size; |
| 25 } |
| 26 |
19 namespace views { | 27 namespace views { |
20 class WebView; | 28 class WebView; |
21 class WidgetDelegate; | 29 class WidgetDelegate; |
22 } | 30 } |
23 | 31 |
24 namespace athena { | 32 namespace athena { |
25 | 33 |
26 class AthenaWebView; | 34 class AthenaWebView; |
27 | 35 |
28 class WebActivity : public Activity, | 36 class WebActivity : public Activity, |
(...skipping 13 matching lines...) Expand all Loading... |
42 virtual void SetCurrentState(ActivityState state) OVERRIDE; | 50 virtual void SetCurrentState(ActivityState state) OVERRIDE; |
43 virtual ActivityState GetCurrentState() OVERRIDE; | 51 virtual ActivityState GetCurrentState() OVERRIDE; |
44 virtual bool IsVisible() OVERRIDE; | 52 virtual bool IsVisible() OVERRIDE; |
45 virtual ActivityMediaState GetMediaState() OVERRIDE; | 53 virtual ActivityMediaState GetMediaState() OVERRIDE; |
46 virtual aura::Window* GetWindow() OVERRIDE; | 54 virtual aura::Window* GetWindow() OVERRIDE; |
47 | 55 |
48 // ActivityViewModel: | 56 // ActivityViewModel: |
49 virtual void Init() OVERRIDE; | 57 virtual void Init() OVERRIDE; |
50 virtual SkColor GetRepresentativeColor() const OVERRIDE; | 58 virtual SkColor GetRepresentativeColor() const OVERRIDE; |
51 virtual base::string16 GetTitle() const OVERRIDE; | 59 virtual base::string16 GetTitle() const OVERRIDE; |
| 60 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
52 virtual bool UsesFrame() const OVERRIDE; | 61 virtual bool UsesFrame() const OVERRIDE; |
53 virtual views::View* GetContentsView() OVERRIDE; | 62 virtual views::View* GetContentsView() OVERRIDE; |
54 virtual void CreateOverviewModeImage() OVERRIDE; | 63 virtual void CreateOverviewModeImage() OVERRIDE; |
55 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; | 64 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; |
56 virtual void PrepareContentsForOverview() OVERRIDE; | 65 virtual void PrepareContentsForOverview() OVERRIDE; |
57 virtual void ResetContentsView() OVERRIDE; | 66 virtual void ResetContentsView() OVERRIDE; |
58 | 67 |
59 // content::WebContentsObserver: | 68 // content::WebContentsObserver: |
| 69 virtual void DidNavigateMainFrame( |
| 70 const content::LoadCommittedDetails& details, |
| 71 const content::FrameNavigateParams& params) OVERRIDE; |
60 virtual void TitleWasSet(content::NavigationEntry* entry, | 72 virtual void TitleWasSet(content::NavigationEntry* entry, |
61 bool explicit_set) OVERRIDE; | 73 bool explicit_set) OVERRIDE; |
62 virtual void DidUpdateFaviconURL( | 74 virtual void DidUpdateFaviconURL( |
63 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 75 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
64 virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE; | 76 virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE; |
65 | 77 |
66 private: | 78 private: |
| 79 // Called when a favicon download initiated in DidUpdateFaviconURL() |
| 80 // has completed. |
| 81 void OnDidDownloadFavicon( |
| 82 int id, |
| 83 int http_status_code, |
| 84 const GURL& url, |
| 85 const std::vector<SkBitmap>& bitmaps, |
| 86 const std::vector<gfx::Size>& original_bitmap_sizes); |
| 87 |
67 // Make the content visible. This call should only be paired with | 88 // Make the content visible. This call should only be paired with |
68 // MakeInvisible. Note: Upon object creation the content is visible. | 89 // MakeInvisible. Note: Upon object creation the content is visible. |
69 void MakeVisible(); | 90 void MakeVisible(); |
70 | 91 |
71 // Make the content invisible. This call should only be paired with | 92 // Make the content invisible. This call should only be paired with |
72 // MakeVisible. | 93 // MakeVisible. |
73 void MakeInvisible(); | 94 void MakeInvisible(); |
74 | 95 |
75 // Reload the content if required, and start observing it. | 96 // Reload the content if required, and start observing it. |
76 void ReloadAndObserve(); | 97 void ReloadAndObserve(); |
77 | 98 |
78 content::BrowserContext* browser_context_; | 99 content::BrowserContext* browser_context_; |
79 const base::string16 title_; | 100 const base::string16 title_; |
| 101 gfx::ImageSkia icon_; |
80 const GURL url_; | 102 const GURL url_; |
81 AthenaWebView* web_view_; | 103 AthenaWebView* web_view_; |
82 SkColor title_color_; | 104 SkColor title_color_; |
83 | 105 |
84 // The current state for this activity. | 106 // The current state for this activity. |
85 ActivityState current_state_; | 107 ActivityState current_state_; |
86 | 108 |
87 // The image which will be used in overview mode. | 109 // The image which will be used in overview mode. |
88 gfx::ImageSkia overview_mode_image_; | 110 gfx::ImageSkia overview_mode_image_; |
89 | 111 |
90 DISALLOW_COPY_AND_ASSIGN(WebActivity); | 112 DISALLOW_COPY_AND_ASSIGN(WebActivity); |
91 }; | 113 }; |
92 | 114 |
93 } // namespace athena | 115 } // namespace athena |
94 | 116 |
95 #endif // ATHENA_CONTENT_WEB_ACTIVITY_H_ | 117 #endif // ATHENA_CONTENT_WEB_ACTIVITY_H_ |
OLD | NEW |