OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/media/desktop_media_list_observer.h" | 9 #include "chrome/browser/media/desktop_media_list_observer.h" |
10 #include "chrome/browser/media/desktop_media_picker.h" | 10 #include "chrome/browser/media/desktop_media_picker.h" |
11 #include "ui/views/window/dialog_delegate.h" | 11 #include "ui/views/window/dialog_delegate.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 class ImageView; | 14 class ImageView; |
15 class Label; | 15 class Label; |
16 class Checkbox; | 16 class Checkbox; |
17 } // namespace views | 17 } // namespace views |
18 | 18 |
19 class DesktopMediaPickerDialogView; | 19 class DesktopMediaPickerDialogView; |
20 class DesktopMediaPickerViews; | 20 class DesktopMediaPickerViews; |
21 class DesktopMediaSourceView; | 21 class DesktopMediaSourceView; |
22 | 22 |
23 // View that shows a list of desktop media sources available from | 23 // View that shows a list of desktop media sources available from |
24 // DesktopMediaList. | 24 // DesktopMediaList. |
25 class DesktopMediaListView : public views::View, | 25 class DesktopMediaListView : public views::View, |
26 public DesktopMediaListObserver { | 26 public DesktopMediaListObserver { |
27 public: | 27 public: |
28 DesktopMediaListView(DesktopMediaPickerDialogView* parent, | 28 DesktopMediaListView(DesktopMediaPickerDialogView* parent, |
29 scoped_ptr<DesktopMediaList> media_list); | 29 std::unique_ptr<DesktopMediaList> media_list); |
30 ~DesktopMediaListView() override; | 30 ~DesktopMediaListView() override; |
31 | 31 |
32 void StartUpdating(content::DesktopMediaID dialog_window_id); | 32 void StartUpdating(content::DesktopMediaID dialog_window_id); |
33 | 33 |
34 // Called by DesktopMediaSourceView when selection has changed. | 34 // Called by DesktopMediaSourceView when selection has changed. |
35 void OnSelectionChanged(); | 35 void OnSelectionChanged(); |
36 | 36 |
37 // Called by DesktopMediaSourceView when a source has been double-clicked. | 37 // Called by DesktopMediaSourceView when a source has been double-clicked. |
38 void OnDoubleClick(); | 38 void OnDoubleClick(); |
39 | 39 |
(...skipping 12 matching lines...) Expand all Loading... |
52 void OnSourceMoved(DesktopMediaList* list, | 52 void OnSourceMoved(DesktopMediaList* list, |
53 int old_index, | 53 int old_index, |
54 int new_index) override; | 54 int new_index) override; |
55 void OnSourceNameChanged(DesktopMediaList* list, int index) override; | 55 void OnSourceNameChanged(DesktopMediaList* list, int index) override; |
56 void OnSourceThumbnailChanged(DesktopMediaList* list, int index) override; | 56 void OnSourceThumbnailChanged(DesktopMediaList* list, int index) override; |
57 | 57 |
58 // Accepts whatever happens to be selected right now. | 58 // Accepts whatever happens to be selected right now. |
59 void AcceptSelection(); | 59 void AcceptSelection(); |
60 | 60 |
61 DesktopMediaPickerDialogView* parent_; | 61 DesktopMediaPickerDialogView* parent_; |
62 scoped_ptr<DesktopMediaList> media_list_; | 62 std::unique_ptr<DesktopMediaList> media_list_; |
63 base::WeakPtrFactory<DesktopMediaListView> weak_factory_; | 63 base::WeakPtrFactory<DesktopMediaListView> weak_factory_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListView); | 65 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListView); |
66 }; | 66 }; |
67 | 67 |
68 // View used for each item in DesktopMediaListView. Shows a single desktop media | 68 // View used for each item in DesktopMediaListView. Shows a single desktop media |
69 // source as a thumbnail with the title under it. | 69 // source as a thumbnail with the title under it. |
70 class DesktopMediaSourceView : public views::View { | 70 class DesktopMediaSourceView : public views::View { |
71 public: | 71 public: |
72 DesktopMediaSourceView(DesktopMediaListView* parent, | 72 DesktopMediaSourceView(DesktopMediaListView* parent, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 }; | 112 }; |
113 | 113 |
114 // Dialog view used for DesktopMediaPickerViews. | 114 // Dialog view used for DesktopMediaPickerViews. |
115 class DesktopMediaPickerDialogView : public views::DialogDelegateView { | 115 class DesktopMediaPickerDialogView : public views::DialogDelegateView { |
116 public: | 116 public: |
117 DesktopMediaPickerDialogView(content::WebContents* parent_web_contents, | 117 DesktopMediaPickerDialogView(content::WebContents* parent_web_contents, |
118 gfx::NativeWindow context, | 118 gfx::NativeWindow context, |
119 DesktopMediaPickerViews* parent, | 119 DesktopMediaPickerViews* parent, |
120 const base::string16& app_name, | 120 const base::string16& app_name, |
121 const base::string16& target_name, | 121 const base::string16& target_name, |
122 scoped_ptr<DesktopMediaList> media_list, | 122 std::unique_ptr<DesktopMediaList> media_list, |
123 bool request_audio); | 123 bool request_audio); |
124 ~DesktopMediaPickerDialogView() override; | 124 ~DesktopMediaPickerDialogView() override; |
125 | 125 |
126 // Called by parent (DesktopMediaPickerViews) when it's destroyed. | 126 // Called by parent (DesktopMediaPickerViews) when it's destroyed. |
127 void DetachParent(); | 127 void DetachParent(); |
128 | 128 |
129 // Called by DesktopMediaListView. | 129 // Called by DesktopMediaListView. |
130 void OnSelectionChanged(); | 130 void OnSelectionChanged(); |
131 void OnDoubleClick(); | 131 void OnDoubleClick(); |
132 | 132 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ~DesktopMediaPickerViews() override; | 166 ~DesktopMediaPickerViews() override; |
167 | 167 |
168 void NotifyDialogResult(content::DesktopMediaID source); | 168 void NotifyDialogResult(content::DesktopMediaID source); |
169 | 169 |
170 // DesktopMediaPicker overrides. | 170 // DesktopMediaPicker overrides. |
171 void Show(content::WebContents* web_contents, | 171 void Show(content::WebContents* web_contents, |
172 gfx::NativeWindow context, | 172 gfx::NativeWindow context, |
173 gfx::NativeWindow parent, | 173 gfx::NativeWindow parent, |
174 const base::string16& app_name, | 174 const base::string16& app_name, |
175 const base::string16& target_name, | 175 const base::string16& target_name, |
176 scoped_ptr<DesktopMediaList> media_list, | 176 std::unique_ptr<DesktopMediaList> media_list, |
177 bool request_audio, | 177 bool request_audio, |
178 const DoneCallback& done_callback) override; | 178 const DoneCallback& done_callback) override; |
179 | 179 |
180 DesktopMediaPickerDialogView* GetDialogViewForTesting() const { | 180 DesktopMediaPickerDialogView* GetDialogViewForTesting() const { |
181 return dialog_; | 181 return dialog_; |
182 } | 182 } |
183 | 183 |
184 private: | 184 private: |
185 DoneCallback callback_; | 185 DoneCallback callback_; |
186 | 186 |
187 // The |dialog_| is owned by the corresponding views::Widget instance. | 187 // The |dialog_| is owned by the corresponding views::Widget instance. |
188 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed | 188 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed |
189 // asynchronously by closing the widget. | 189 // asynchronously by closing the widget. |
190 DesktopMediaPickerDialogView* dialog_; | 190 DesktopMediaPickerDialogView* dialog_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); | 192 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); |
193 }; | 193 }; |
194 | 194 |
195 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 195 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
OLD | NEW |