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

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

Issue 2307083002: Cleanup: move WebRTC related files from chrome/browser/media to chrome/browser/media/webrtc/ (Closed)
Patch Set: Removed file wrongly resuscitated during rebase Created 4 years, 3 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
(Empty)
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_NATIVE_DESKTOP_MEDIA_LIST_H_
6 #define CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_
7
8 #include <memory>
9
10 #include "base/memory/weak_ptr.h"
11 #include "base/sequenced_task_runner.h"
12 #include "chrome/browser/media/desktop_media_list_base.h"
13 #include "content/public/browser/desktop_media_id.h"
14 #include "ui/gfx/image/image.h"
15
16 namespace webrtc {
17 class ScreenCapturer;
18 class WindowCapturer;
19 }
20
21 // Implementation of DesktopMediaList that shows native screens and
22 // native windows.
23 class NativeDesktopMediaList : public DesktopMediaListBase {
24 public:
25 // Caller may pass NULL for either of the arguments in case when only some
26 // types of sources the model should be populated with (e.g. it will only
27 // contain windows, if |screen_capturer| is NULL).
28 NativeDesktopMediaList(
29 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer,
30 std::unique_ptr<webrtc::WindowCapturer> window_capturer);
31 ~NativeDesktopMediaList() override;
32
33 private:
34 typedef std::map<content::DesktopMediaID, uint32_t> ImageHashesMap;
35
36 class Worker;
37 friend class Worker;
38
39 // Refresh() posts a task for the |worker_| to update list of windows, get
40 // thumbnails and schedule next refresh.
41 void Refresh() override;
42
43 void RefreshForAuraWindows(std::vector<SourceDescription> sources);
44 void UpdateNativeThumbnailsFinished();
45
46 #if defined(USE_AURA)
47 void CaptureAuraWindowThumbnail(const content::DesktopMediaID& id);
48 void OnAuraThumbnailCaptured(const content::DesktopMediaID& id,
49 const gfx::Image& image);
50 #endif
51
52 // Task runner used for the |worker_|.
53 scoped_refptr<base::SequencedTaskRunner> capture_task_runner_;
54
55 // An object that does all the work of getting list of sources on a background
56 // thread (see |capture_task_runner_|). Destroyed on |capture_task_runner_|
57 // after the model is destroyed.
58 std::unique_ptr<Worker> worker_;
59
60 #if defined(USE_AURA)
61 // previous_aura_thumbnail_hashes_ holds thumbanil hash values of aura windows
62 // in the previous refresh. While new_aura_thumbnail_hashes_ has hash values
63 // of the ongoing refresh. Those two maps are used to detect new thumbnails
64 // and changed thumbnails from the previous refresh.
65 ImageHashesMap previous_aura_thumbnail_hashes_;
66 ImageHashesMap new_aura_thumbnail_hashes_;
67
68 int pending_aura_capture_requests_ = 0;
69 bool pending_native_thumbnail_capture_ = false;
70 #endif
71 base::WeakPtrFactory<NativeDesktopMediaList> weak_factory_;
72
73 DISALLOW_COPY_AND_ASSIGN(NativeDesktopMediaList);
74 };
75
76 #endif // CHROME_BROWSER_MEDIA_NATIVE_DESKTOP_MEDIA_LIST_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_infobar_delegate_android.cc ('k') | chrome/browser/media/native_desktop_media_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698