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

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

Powered by Google App Engine
This is Rietveld 408576698