Index: chrome/browser/media/desktop_media_list.h |
diff --git a/chrome/browser/media/desktop_media_list.h b/chrome/browser/media/desktop_media_list.h |
index 86ac37c02f869e0c1f2813b84ac5bbbbac0c38f6..77a113c6d2cbda8d0f3aef5869515121661166e5 100644 |
--- a/chrome/browser/media/desktop_media_list.h |
+++ b/chrome/browser/media/desktop_media_list.h |
@@ -5,9 +5,14 @@ |
#ifndef CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_H_ |
#define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_H_ |
+#include "base/id_map.h" |
+#include "base/memory/singleton.h" |
#include "base/strings/string16.h" |
#include "base/time/time.h" |
#include "content/public/browser/desktop_media_id.h" |
+#include "content/public/browser/web_contents.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "ui/gfx/image/image.h" |
#include "ui/gfx/image/image_skia.h" |
class DesktopMediaListObserver; |
@@ -57,4 +62,33 @@ class DesktopMediaList { |
virtual const Source& GetSource(int index) const = 0; |
}; |
+// Create a image with an enlarged favicon on its center and black boundary. |
+// If fails, an empty image will return. |
+// The function is used to create a thumbnail for chrome tab preview. |
+gfx::ImageSkia CreateEnlargedFaviconImage(gfx::Size size, gfx::Image& favicon); |
+ |
+// Register WebContents. |
+class WebContentsRegistry : public content::WebContentsObserver { |
+ public: |
+ static WebContentsRegistry* GetInstance(); |
+ |
+ // Return an id to represent the WebContents. |
+ int RegisterWebContents(content::WebContents* web_contents); |
+ // Get a registed WebContents by id. If the Webcontent is destroyed, a nullptr |
+ // will be return. |
+ content::WebContents* GetWebContentsById(int id); |
+ |
+ private: |
+ friend struct base::DefaultSingletonTraits<WebContentsRegistry>; |
+ WebContentsRegistry(); |
+ ~WebContentsRegistry() override; |
+ |
+ // content::WebContentsObserver overrides. |
+ void WebContentsDestroyed(content::WebContents* web_contents) override; |
+ |
+ IDMap<content::WebContents> registered_web_contents_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebContentsRegistry); |
+}; |
+ |
#endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_H_ |