1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_ASH_H_
6 #define CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_ASH_H_
7 
8 #include <vector>
9 
10 #include "base/memory/weak_ptr.h"
11 #include "base/sequence_checker.h"
12 #include "chrome/browser/media/webrtc/desktop_media_list_base.h"
13 #include "content/public/browser/desktop_media_id.h"
14 
15 namespace aura {
16 class Window;
17 }
18 
19 namespace gfx {
20 class Image;
21 }
22 
23 // Implementation of DesktopMediaList that shows native screens and
24 // native windows.
25 class DesktopMediaListAsh : public DesktopMediaListBase {
26  public:
27   explicit DesktopMediaListAsh(content::DesktopMediaID::Type type);
28   ~DesktopMediaListAsh() override;
29 
30  private:
31   // Override from DesktopMediaListBase.
32   void Refresh(bool update_thumnails) override;
33   void EnumerateWindowsForRoot(
34       std::vector<DesktopMediaListAsh::SourceDescription>* windows,
35       bool update_thumnails,
36       aura::Window* root_window,
37       int container_id);
38   void EnumerateSources(
39       std::vector<DesktopMediaListAsh::SourceDescription>* windows,
40       bool update_thumnails);
41   void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window);
42   void OnThumbnailCaptured(content::DesktopMediaID id, gfx::Image image);
43   void OnRefreshMaybeComplete();
44 
45   int pending_window_capture_requests_ = 0;
46 
47   SEQUENCE_CHECKER(sequence_checker_);
48 
49   base::WeakPtrFactory<DesktopMediaListAsh> weak_factory_{this};
50 
51   DISALLOW_COPY_AND_ASSIGN(DesktopMediaListAsh);
52 };
53 
54 #endif  // CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_ASH_H_
55