Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: athena/content/web_activity.h

Issue 548633005: Adding overview / layer framework to Activities so that unloaded / sleeping activities can be shown… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/memory/scoped_ptr.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
12 #include "ui/gfx/image/image_skia.h" 13 #include "ui/gfx/image/image_skia.h"
13 14
14 namespace content { 15 namespace content {
15 class BrowserContext; 16 class BrowserContext;
16 class WebContents; 17 class WebContents;
17 } 18 }
18 19
19 namespace views { 20 namespace views {
20 class WebView; 21 class WebView;
21 class WidgetDelegate; 22 class WidgetDelegate;
22 } 23 }
23 24
24 namespace athena { 25 namespace athena {
25 26
26 class AthenaWebView; 27 class AthenaWebView;
28 class ContentProxy;
27 29
28 class WebActivity : public Activity, 30 class WebActivity : public Activity,
29 public ActivityViewModel, 31 public ActivityViewModel,
30 public content::WebContentsObserver { 32 public content::WebContentsObserver {
31 public: 33 public:
32 WebActivity(content::BrowserContext* context, 34 WebActivity(content::BrowserContext* context,
33 const base::string16& title, 35 const base::string16& title,
34 const GURL& gurl); 36 const GURL& gurl);
35 WebActivity(AthenaWebView* web_view); 37 WebActivity(AthenaWebView* web_view);
36 38
37 protected: 39 protected:
38 virtual ~WebActivity(); 40 virtual ~WebActivity();
39 41
40 // Activity: 42 // Activity:
41 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE; 43 virtual athena::ActivityViewModel* GetActivityViewModel() OVERRIDE;
42 virtual void SetCurrentState(ActivityState state) OVERRIDE; 44 virtual void SetCurrentState(ActivityState state) OVERRIDE;
43 virtual ActivityState GetCurrentState() OVERRIDE; 45 virtual ActivityState GetCurrentState() OVERRIDE;
44 virtual bool IsVisible() OVERRIDE; 46 virtual bool IsVisible() OVERRIDE;
45 virtual ActivityMediaState GetMediaState() OVERRIDE; 47 virtual ActivityMediaState GetMediaState() OVERRIDE;
46 virtual aura::Window* GetWindow() OVERRIDE; 48 virtual aura::Window* GetWindow() OVERRIDE;
47 49
48 // ActivityViewModel: 50 // ActivityViewModel:
49 virtual void Init() OVERRIDE; 51 virtual void Init() OVERRIDE;
50 virtual SkColor GetRepresentativeColor() const OVERRIDE; 52 virtual SkColor GetRepresentativeColor() const OVERRIDE;
51 virtual base::string16 GetTitle() const OVERRIDE; 53 virtual base::string16 GetTitle() const OVERRIDE;
52 virtual bool UsesFrame() const OVERRIDE; 54 virtual bool UsesFrame() const OVERRIDE;
53 virtual views::View* GetContentsView() OVERRIDE; 55 virtual views::View* GetContentsView() OVERRIDE;
54 virtual void CreateOverviewModeImage() OVERRIDE;
55 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE; 56 virtual gfx::ImageSkia GetOverviewModeImage() OVERRIDE;
56 virtual void PrepareContentsForOverview() OVERRIDE; 57 virtual void PrepareContentsForOverview() OVERRIDE;
57 virtual void ResetContentsView() OVERRIDE; 58 virtual void ResetContentsView() OVERRIDE;
58 59
59 // content::WebContentsObserver: 60 // content::WebContentsObserver:
60 virtual void TitleWasSet(content::NavigationEntry* entry, 61 virtual void TitleWasSet(content::NavigationEntry* entry,
61 bool explicit_set) OVERRIDE; 62 bool explicit_set) OVERRIDE;
62 virtual void DidUpdateFaviconURL( 63 virtual void DidUpdateFaviconURL(
63 const std::vector<content::FaviconURL>& candidates) OVERRIDE; 64 const std::vector<content::FaviconURL>& candidates) OVERRIDE;
64 virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE; 65 virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE;
65 66
66 private: 67 private:
67 // Make the content visible. This call should only be paired with 68 // Hiding the contet proxy and showing the real content instead.
68 // MakeInvisible. Note: Upon object creation the content is visible. 69 void HideContentProxy();
69 void MakeVisible();
70 70
71 // Make the content invisible. This call should only be paired with 71 // Showing a content proxy instead of the real content to save resoruces.
72 // MakeVisible. 72 void ShowContentProxy();
73 void MakeInvisible();
74 73
75 // Reload the content if required, and start observing it. 74 // Reload the content if required, and start observing it.
76 void ReloadAndObserve(); 75 void ReloadAndObserve();
77 76
78 content::BrowserContext* browser_context_; 77 content::BrowserContext* browser_context_;
79 const base::string16 title_; 78 const base::string16 title_;
80 const GURL url_; 79 const GURL url_;
81 AthenaWebView* web_view_; 80 AthenaWebView* web_view_;
82 SkColor title_color_; 81 SkColor title_color_;
83 82
84 // The current state for this activity. 83 // The current state for this activity.
85 ActivityState current_state_; 84 ActivityState current_state_;
86 85
87 // The image which will be used in overview mode. 86 // The content proxy.
88 gfx::ImageSkia overview_mode_image_; 87 scoped_ptr<ContentProxy> content_proxy_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(WebActivity); 89 DISALLOW_COPY_AND_ASSIGN(WebActivity);
91 }; 90 };
92 91
93 } // namespace athena 92 } // namespace athena
94 93
95 #endif // ATHENA_CONTENT_WEB_ACTIVITY_H_ 94 #endif // ATHENA_CONTENT_WEB_ACTIVITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698