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

Unified Diff: chrome/browser/media/desktop_media_list.h

Issue 1503563004: Desktop chrome tab capture-chooseDesktopMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698