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

Side by Side Diff: chrome/browser/media/native_desktop_media_list.h

Issue 1808273002: Use DesktopCaptureDeviceAura for all aura windows in Windows and Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2013 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_ 5 #ifndef CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_
6 #define CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_ 6 #define CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "chrome/browser/media/desktop_media_list_base.h" 11 #include "chrome/browser/media/desktop_media_list_base.h"
12 #include "content/public/browser/desktop_media_id.h" 12 #include "content/public/browser/desktop_media_id.h"
13 #include "ui/gfx/image/image.h" 13 #include "ui/gfx/image/image.h"
14 14
15 namespace webrtc { 15 namespace webrtc {
16 class ScreenCapturer; 16 class ScreenCapturer;
17 class WindowCapturer; 17 class WindowCapturer;
18 } 18 }
19 19
20 // Implementation of DesktopMediaList that shows native screens and 20 // Implementation of DesktopMediaList that shows native screens and
21 // native windows. 21 // native windows.
22 class NativeDesktopMediaList : public DesktopMediaListBase { 22 class NativeDesktopMediaList : public DesktopMediaListBase {
23 public: 23 public:
24 typedef std::map<content::DesktopMediaID::Id, content::DesktopMediaID::Id>
25 NativeAuraIdMap;
26
27 // Caller may pass NULL for either of the arguments in case when only some 24 // Caller may pass NULL for either of the arguments in case when only some
28 // types of sources the model should be populated with (e.g. it will only 25 // types of sources the model should be populated with (e.g. it will only
29 // contain windows, if |screen_capturer| is NULL). 26 // contain windows, if |screen_capturer| is NULL).
30 NativeDesktopMediaList( 27 NativeDesktopMediaList(
31 scoped_ptr<webrtc::ScreenCapturer> screen_capturer, 28 scoped_ptr<webrtc::ScreenCapturer> screen_capturer,
32 scoped_ptr<webrtc::WindowCapturer> window_capturer); 29 scoped_ptr<webrtc::WindowCapturer> window_capturer);
33 ~NativeDesktopMediaList() override; 30 ~NativeDesktopMediaList() override;
34 31
35 private: 32 private:
36 typedef std::map<content::DesktopMediaID, uint32_t> ImageHashesMap; 33 typedef std::map<content::DesktopMediaID, uint32_t> ImageHashesMap;
37 34
38 class Worker; 35 class Worker;
39 friend class Worker; 36 friend class Worker;
40 37
41 // Refresh() posts a task for the |worker_| to update list of windows and get 38 // Refresh() posts a task for the |worker_| to update list of windows, get
42 // thumbnails. Then |worker_| first posts tasks for 39 // thumbnails and schedule next refresh.
43 // UpdateObserverSourcesList() with fresh list of sources, then follows with
44 // OnSourceThumbnail() for each changed thumbnail and then calls
45 // DelayLaunchNextRefersh() at the end.
46 void Refresh() override; 40 void Refresh() override;
47 41
48 void OnSourceThumbnailCaptured(int index, const gfx::ImageSkia& image); 42 void RefreshForAuraWindows(std::vector<SourceDescription> sources);
49 void FinishRefreshOnUiThreadAndScheduleNext( 43 void UpdateNativeThumbnailsFinished();
50 const std::vector<content::DesktopMediaID>& aura_ids);
51 44
52 #if defined(USE_AURA) 45 #if defined(USE_AURA)
53 void CaptureAuraWindowThumbnail(const content::DesktopMediaID& id); 46 void CaptureAuraWindowThumbnail(const content::DesktopMediaID& id);
54 void OnAuraThumbnailCaptured(const content::DesktopMediaID& id, 47 void OnAuraThumbnailCaptured(const content::DesktopMediaID& id,
55 const gfx::Image& image); 48 const gfx::Image& image);
56 #endif 49 #endif
57 50
58 // Task runner used for the |worker_|. 51 // Task runner used for the |worker_|.
59 scoped_refptr<base::SequencedTaskRunner> capture_task_runner_; 52 scoped_refptr<base::SequencedTaskRunner> capture_task_runner_;
60 53
61 // An object that does all the work of getting list of sources on a background 54 // An object that does all the work of getting list of sources on a background
62 // thread (see |capture_task_runner_|). Destroyed on |capture_task_runner_| 55 // thread (see |capture_task_runner_|). Destroyed on |capture_task_runner_|
63 // after the model is destroyed. 56 // after the model is destroyed.
64 scoped_ptr<Worker> worker_; 57 scoped_ptr<Worker> worker_;
65 58
66 #if defined(USE_AURA) 59 #if defined(USE_AURA)
67 // previous_aura_thumbnail_hashes_ holds thumbanil hash values of aura windows 60 // previous_aura_thumbnail_hashes_ holds thumbanil hash values of aura windows
68 // in the previous refresh. While new_aura_thumbnail_hashes_ has hash values 61 // in the previous refresh. While new_aura_thumbnail_hashes_ has hash values
69 // of the ongoing refresh. Those two maps are used to detect new thumbnails 62 // of the ongoing refresh. Those two maps are used to detect new thumbnails
70 // and changed thumbnails from the previous refresh. 63 // and changed thumbnails from the previous refresh.
71 ImageHashesMap previous_aura_thumbnail_hashes_; 64 ImageHashesMap previous_aura_thumbnail_hashes_;
72 ImageHashesMap new_aura_thumbnail_hashes_; 65 ImageHashesMap new_aura_thumbnail_hashes_;
73 66
74 int pending_aura_capture_requests_; 67 int pending_aura_capture_requests_ = 0;
68 bool pending_native_thumbnail_capture_ = true;
Sergey Ulanov 2016/03/21 20:55:00 I think you want to initialize it to false. It's n
75 #endif 69 #endif
76 70
77 base::WeakPtrFactory<NativeDesktopMediaList> weak_factory_; 71 base::WeakPtrFactory<NativeDesktopMediaList> weak_factory_;
78 72
79 DISALLOW_COPY_AND_ASSIGN(NativeDesktopMediaList); 73 DISALLOW_COPY_AND_ASSIGN(NativeDesktopMediaList);
80 }; 74 };
81 75
82 #endif // CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_ 76 #endif // CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/native_desktop_media_list.cc » ('j') | chrome/browser/media/native_desktop_media_list.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698