| 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 } // namespace views | 17 } // namespace views |
| 17 | 18 |
| 18 class DesktopMediaPickerDialogView; | 19 class DesktopMediaPickerDialogView; |
| 19 class DesktopMediaPickerViews; | 20 class DesktopMediaPickerViews; |
| 20 class DesktopMediaSourceView; | 21 class DesktopMediaSourceView; |
| 21 | 22 |
| 22 // View that shows a list of desktop media sources available from | 23 // View that shows a list of desktop media sources available from |
| 23 // DesktopMediaList. | 24 // DesktopMediaList. |
| 24 class DesktopMediaListView : public views::View, | 25 class DesktopMediaListView : public views::View, |
| 25 public DesktopMediaListObserver { | 26 public DesktopMediaListObserver { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 // Dialog view used for DesktopMediaPickerViews. | 112 // Dialog view used for DesktopMediaPickerViews. |
| 112 class DesktopMediaPickerDialogView : public views::DialogDelegateView { | 113 class DesktopMediaPickerDialogView : public views::DialogDelegateView { |
| 113 public: | 114 public: |
| 114 DesktopMediaPickerDialogView(content::WebContents* parent_web_contents, | 115 DesktopMediaPickerDialogView(content::WebContents* parent_web_contents, |
| 115 gfx::NativeWindow context, | 116 gfx::NativeWindow context, |
| 116 DesktopMediaPickerViews* parent, | 117 DesktopMediaPickerViews* parent, |
| 117 const base::string16& app_name, | 118 const base::string16& app_name, |
| 118 const base::string16& target_name, | 119 const base::string16& target_name, |
| 119 scoped_ptr<DesktopMediaList> media_list); | 120 scoped_ptr<DesktopMediaList> media_list, |
| 121 bool request_audio); |
| 120 ~DesktopMediaPickerDialogView() override; | 122 ~DesktopMediaPickerDialogView() override; |
| 121 | 123 |
| 122 // Called by parent (DesktopMediaPickerViews) when it's destroyed. | 124 // Called by parent (DesktopMediaPickerViews) when it's destroyed. |
| 123 void DetachParent(); | 125 void DetachParent(); |
| 124 | 126 |
| 125 // Called by DesktopMediaListView. | 127 // Called by DesktopMediaListView. |
| 126 void OnSelectionChanged(); | 128 void OnSelectionChanged(); |
| 127 void OnDoubleClick(); | 129 void OnDoubleClick(); |
| 128 | 130 |
| 129 // views::View overrides. | 131 // views::View overrides. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 141 | 143 |
| 142 void OnMediaListRowsChanged(); | 144 void OnMediaListRowsChanged(); |
| 143 | 145 |
| 144 DesktopMediaListView* GetMediaListViewForTesting() const; | 146 DesktopMediaListView* GetMediaListViewForTesting() const; |
| 145 DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const; | 147 DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const; |
| 146 | 148 |
| 147 private: | 149 private: |
| 148 DesktopMediaPickerViews* parent_; | 150 DesktopMediaPickerViews* parent_; |
| 149 base::string16 app_name_; | 151 base::string16 app_name_; |
| 150 | 152 |
| 151 views::Label* label_; | 153 views::Label* description_label_; |
| 152 views::ScrollView* scroll_view_; | 154 views::Checkbox* audio_share_checkbox_; |
| 153 DesktopMediaListView* list_view_; | 155 views::ScrollView* sources_scroll_view_; |
| 156 DesktopMediaListView* sources_list_view_; |
| 154 | 157 |
| 155 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView); | 158 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView); |
| 156 }; | 159 }; |
| 157 | 160 |
| 158 // Implementation of DesktopMediaPicker for Views. | 161 // Implementation of DesktopMediaPicker for Views. |
| 159 class DesktopMediaPickerViews : public DesktopMediaPicker { | 162 class DesktopMediaPickerViews : public DesktopMediaPicker { |
| 160 public: | 163 public: |
| 161 DesktopMediaPickerViews(); | 164 DesktopMediaPickerViews(); |
| 162 ~DesktopMediaPickerViews() override; | 165 ~DesktopMediaPickerViews() override; |
| 163 | 166 |
| 164 void NotifyDialogResult(content::DesktopMediaID source); | 167 void NotifyDialogResult(content::DesktopMediaID source); |
| 165 | 168 |
| 166 // DesktopMediaPicker overrides. | 169 // DesktopMediaPicker overrides. |
| 167 void Show(content::WebContents* web_contents, | 170 void Show(content::WebContents* web_contents, |
| 168 gfx::NativeWindow context, | 171 gfx::NativeWindow context, |
| 169 gfx::NativeWindow parent, | 172 gfx::NativeWindow parent, |
| 170 const base::string16& app_name, | 173 const base::string16& app_name, |
| 171 const base::string16& target_name, | 174 const base::string16& target_name, |
| 172 scoped_ptr<DesktopMediaList> media_list, | 175 scoped_ptr<DesktopMediaList> media_list, |
| 176 bool request_audio, |
| 173 const DoneCallback& done_callback) override; | 177 const DoneCallback& done_callback) override; |
| 174 | 178 |
| 175 DesktopMediaPickerDialogView* GetDialogViewForTesting() const { | 179 DesktopMediaPickerDialogView* GetDialogViewForTesting() const { |
| 176 return dialog_; | 180 return dialog_; |
| 177 } | 181 } |
| 178 | 182 |
| 179 private: | 183 private: |
| 180 DoneCallback callback_; | 184 DoneCallback callback_; |
| 181 | 185 |
| 182 // The |dialog_| is owned by the corresponding views::Widget instance. | 186 // The |dialog_| is owned by the corresponding views::Widget instance. |
| 183 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed | 187 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed |
| 184 // asynchronously by closing the widget. | 188 // asynchronously by closing the widget. |
| 185 DesktopMediaPickerDialogView* dialog_; | 189 DesktopMediaPickerDialogView* dialog_; |
| 186 | 190 |
| 187 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); | 191 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); |
| 188 }; | 192 }; |
| 189 | 193 |
| 190 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 194 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
| OLD | NEW |