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

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

Issue 1763753003: Capture chrome browser windows from internal rendering procedure for 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 14
14 namespace webrtc { 15 namespace webrtc {
15 class ScreenCapturer; 16 class ScreenCapturer;
16 class WindowCapturer; 17 class WindowCapturer;
17 } 18 }
18 19
19 // Implementation of DesktopMediaList that shows native screens and 20 // Implementation of DesktopMediaList that shows native screens and
20 // native windows. 21 // native windows.
21 class NativeDesktopMediaList : public DesktopMediaListBase { 22 class NativeDesktopMediaList : public DesktopMediaListBase {
22 public: 23 public:
23 // 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
24 // 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
25 // contain windows, if |screen_capturer| is NULL). 26 // contain windows, if |screen_capturer| is NULL).
26 NativeDesktopMediaList( 27 NativeDesktopMediaList(
27 scoped_ptr<webrtc::ScreenCapturer> screen_capturer, 28 scoped_ptr<webrtc::ScreenCapturer> screen_capturer,
28 scoped_ptr<webrtc::WindowCapturer> window_capturer); 29 scoped_ptr<webrtc::WindowCapturer> window_capturer);
29 ~NativeDesktopMediaList() override; 30 ~NativeDesktopMediaList() override;
30 31
31 private: 32 private:
33 typedef std::map<DesktopMediaID::Id, DesktopMediaID::Id> NativeAuraIdMap;
34 typedef std::map<DesktopMediaID, uint32_t> ImageHashesMap;
35
32 class Worker; 36 class Worker;
33 friend class Worker; 37 friend class Worker;
34 38
35 // Refresh() posts a task for the |worker_| to update list of windows and get 39 // Refresh() posts a task for the |worker_| to update list of windows and get
36 // thumbnails. Then |worker_| first posts tasks for 40 // thumbnails. Then |worker_| first posts tasks for
37 // UpdateObserverSourcesList() with fresh list of sources, then follows with 41 // UpdateObserverSourcesList() with fresh list of sources, then follows with
38 // OnSourceThumbnail() for each changed thumbnail and then calls 42 // OnSourceThumbnail() for each changed thumbnail and then calls
39 // DelayLaunchNextRefersh() at the end. 43 // DelayLaunchNextRefersh() at the end.
40 void Refresh() override; 44 void Refresh() override;
41 void OnSourceThumbnail(int index, const gfx::ImageSkia& image); 45 void OnSourceThumbnailCaptured(int index, const gfx::ImageSkia& image);
46 void OnAuraThumbnailCaptured(DesktopMediaID id,
47 int total_aura_windows,
48 const gfx::Image& image);
42 49
43 // Task runner used for the |worker_|. 50 // Task runner used for the |worker_|.
44 scoped_refptr<base::SequencedTaskRunner> capture_task_runner_; 51 scoped_refptr<base::SequencedTaskRunner> capture_task_runner_;
45 52
46 // An object that does all the work of getting list of sources on a background 53 // An object that does all the work of getting list of sources on a background
47 // thread (see |capture_task_runner_|). Destroyed on |capture_task_runner_| 54 // thread (see |capture_task_runner_|). Destroyed on |capture_task_runner_|
48 // after the model is destroyed. 55 // after the model is destroyed.
49 scoped_ptr<Worker> worker_; 56 scoped_ptr<Worker> worker_;
50 57
58 int processed_aura_window_count_;
59 ImageHashesMap aura_thumbnail_hashes_;
60 ImageHashesMap cur_aura_thumbnail_hashes_;
Sergey Ulanov 2016/03/07 21:01:50 call this new_aura_thumbnail_hashes_? Also add com
GeorgeZ 2016/03/09 22:38:52 Done.
61
62 #if defined(USE_AURA)
63 NativeAuraIdMap GetBrowserNativeAuraIdMap();
64 void CaptureAuraWindowThumbnail(DesktopMediaID id, int total_aura_windows);
65 #endif
66
51 base::WeakPtrFactory<NativeDesktopMediaList> weak_factory_; 67 base::WeakPtrFactory<NativeDesktopMediaList> weak_factory_;
52 68
53 DISALLOW_COPY_AND_ASSIGN(NativeDesktopMediaList); 69 DISALLOW_COPY_AND_ASSIGN(NativeDesktopMediaList);
54 }; 70 };
55 71
56 #endif // CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_ 72 #endif // CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698