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

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

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

Powered by Google App Engine
This is Rietveld 408576698