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

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

Issue 100833002: Add AshDesktopMediaList and enable Desktop Capture API on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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_ASH_DESKTOP_MEDIA_LIST_H_
6 #define CHROME_BROWSER_MEDIA_ASH_DESKTOP_MEDIA_LIST_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/sequenced_task_runner.h"
12 #include "chrome/browser/media/desktop_media_list.h"
13 #include "content/public/browser/desktop_media_id.h"
14 #include "ui/gfx/image/image_skia.h"
15
16 class SkBitmap;
17
18 namespace aura {
19 class Window;
20 }
21
22 namespace cc {
23 class CopyOutputResult;
24 class SingleReleaseCallback;
25 }
26
27 // Implementation of DesktopMediaList that shows native screens and
28 // native windows.
29 class AshDesktopMediaList : public DesktopMediaList {
30 public:
31 enum SourceTypes {
32 SCREENS = 1,
33 WINDOWS = 2,
34 };
35
36 explicit AshDesktopMediaList(int source_types);
37 virtual ~AshDesktopMediaList();
38
39 // DesktopMediaList interface.
40 virtual void SetUpdatePeriod(base::TimeDelta period) OVERRIDE;
41 virtual void SetThumbnailSize(const gfx::Size& thumbnail_size) OVERRIDE;
42 virtual void StartUpdating(DesktopMediaListObserver* observer) OVERRIDE;
43 virtual int GetSourceCount() const OVERRIDE;
44 virtual const Source& GetSource(int index) const OVERRIDE;
45 virtual void SetViewDialogWindowId(
46 content::DesktopMediaID::Id dialog_id) OVERRIDE;
47
48 private:
49 // Struct used to represent sources list the model gets from the Worker.
50 struct SourceDescription {
51 SourceDescription(content::DesktopMediaID id, const string16& name);
52
53 content::DesktopMediaID id;
54 string16 name;
55 };
56
57 // Order comparator for sources. Used to sort list of sources.
58 static bool CompareSources(const SourceDescription& a,
59 const SourceDescription& b);
60
61 void Refresh();
62 void EnumerateWindowsForRoot(
63 std::vector<AshDesktopMediaList::SourceDescription>* windows,
64 aura::Window* root_window,
65 int container_id);
66 void EnumerateSources(
67 std::vector<AshDesktopMediaList::SourceDescription>* windows);
68 void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window);
69 void OnThumbnailCaptured(content::DesktopMediaID id,
70 scoped_ptr<cc::CopyOutputResult> result);
71 void OnFrameScalingFinished(content::DesktopMediaID id,
72 scoped_ptr<SkBitmap> captured_bitmap,
73 scoped_ptr<SkBitmap> scaled_bitmap);
74 void OnFrameCaptureFinished();
75
76 int source_types_;
77
78 // Time interval between mode updates.
79 base::TimeDelta update_period_;
80
81 // Size of thumbnails generated by the model.
82 gfx::Size thumbnail_size_;
83
84 // ID of the hosting dialog.
85 content::DesktopMediaID::Id view_dialog_id_;
86
87 // The observer passed to StartUpdating().
88 DesktopMediaListObserver* observer_;
89
90 // Current list of sources.
91 std::vector<Source> sources_;
92
93 int pending_window_capture_requests_;
94
95 base::WeakPtrFactory<AshDesktopMediaList> weak_factory_;
96
97 DISALLOW_COPY_AND_ASSIGN(AshDesktopMediaList);
98 };
99
100 #endif // CHROME_BROWSER_MEDIA_ASH_DESKTOP_MEDIA_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698