| 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_CAPTURE_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_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/controls/tabbed_pane/tabbed_pane_listener.h" |
| 11 #include "ui/views/window/dialog_delegate.h" | 12 #include "ui/views/window/dialog_delegate.h" |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 class ImageView; | 15 class ImageView; |
| 15 class Label; | 16 class Label; |
| 16 class Checkbox; | 17 class Checkbox; |
| 18 class TabbedPane; |
| 17 } // namespace views | 19 } // namespace views |
| 18 | 20 |
| 19 class DesktopMediaPickerDialogView; | 21 class DesktopMediaPickerDialogView; |
| 20 class DesktopMediaPickerViews; | 22 class DesktopMediaPickerViews; |
| 21 class DesktopMediaSourceView; | 23 class DesktopMediaSourceView; |
| 22 | 24 |
| 23 // View that shows a list of desktop media sources available from | 25 // View that shows a list of desktop media sources available from |
| 24 // DesktopMediaList. | 26 // DesktopMediaList. |
| 25 class DesktopMediaListView : public views::View, | 27 class DesktopMediaListView : public views::View, |
| 26 public DesktopMediaListObserver { | 28 public DesktopMediaListObserver { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 107 |
| 106 views::ImageView* image_view_; | 108 views::ImageView* image_view_; |
| 107 views::Label* label_; | 109 views::Label* label_; |
| 108 | 110 |
| 109 bool selected_; | 111 bool selected_; |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView); | 113 DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView); |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 // Dialog view used for DesktopMediaPickerViews. | 116 // Dialog view used for DesktopMediaPickerViews. |
| 115 class DesktopMediaPickerDialogView : public views::DialogDelegateView { | 117 class DesktopMediaPickerDialogView : public views::DialogDelegateView, |
| 118 public views::TabbedPaneListener { |
| 116 public: | 119 public: |
| 117 DesktopMediaPickerDialogView(content::WebContents* parent_web_contents, | 120 DesktopMediaPickerDialogView(content::WebContents* parent_web_contents, |
| 118 gfx::NativeWindow context, | 121 gfx::NativeWindow context, |
| 119 DesktopMediaPickerViews* parent, | 122 DesktopMediaPickerViews* parent, |
| 120 const base::string16& app_name, | 123 const base::string16& app_name, |
| 121 const base::string16& target_name, | 124 const base::string16& target_name, |
| 122 std::unique_ptr<DesktopMediaList> screen_list, | 125 std::unique_ptr<DesktopMediaList> screen_list, |
| 123 std::unique_ptr<DesktopMediaList> window_list, | 126 std::unique_ptr<DesktopMediaList> window_list, |
| 124 std::unique_ptr<DesktopMediaList> tab_list, | 127 std::unique_ptr<DesktopMediaList> tab_list, |
| 125 bool request_audio); | 128 bool request_audio); |
| 126 ~DesktopMediaPickerDialogView() override; | 129 ~DesktopMediaPickerDialogView() override; |
| 127 | 130 |
| 128 // Called by parent (DesktopMediaPickerViews) when it's destroyed. | 131 // Called by parent (DesktopMediaPickerViews) when it's destroyed. |
| 129 void DetachParent(); | 132 void DetachParent(); |
| 130 | 133 |
| 131 // Called by DesktopMediaListView. | 134 // Called by DesktopMediaListView. |
| 132 void OnSelectionChanged(); | 135 void OnSelectionChanged(); |
| 133 void OnDoubleClick(); | 136 void OnDoubleClick(); |
| 134 | 137 |
| 138 // views::TabbedPaneListener overrides. |
| 139 void TabSelectedAt(int index) override; |
| 140 |
| 135 // views::View overrides. | 141 // views::View overrides. |
| 136 gfx::Size GetPreferredSize() const override; | 142 gfx::Size GetPreferredSize() const override; |
| 137 | 143 |
| 138 // views::DialogDelegateView overrides. | 144 // views::DialogDelegateView overrides. |
| 139 ui::ModalType GetModalType() const override; | 145 ui::ModalType GetModalType() const override; |
| 140 base::string16 GetWindowTitle() const override; | 146 base::string16 GetWindowTitle() const override; |
| 141 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 147 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 142 views::View* GetInitiallyFocusedView() override; | 148 views::View* GetInitiallyFocusedView() override; |
| 149 bool ShouldDefaultButtonBeBlue() const override; |
| 143 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 150 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 151 View* CreateExtraView() override; |
| 144 bool Accept() override; | 152 bool Accept() override; |
| 145 void DeleteDelegate() override; | 153 void DeleteDelegate() override; |
| 146 | 154 |
| 147 void OnMediaListRowsChanged(); | 155 void OnMediaListRowsChanged(); |
| 148 | 156 |
| 149 DesktopMediaListView* GetMediaListViewForTesting() const; | 157 DesktopMediaListView* GetMediaListViewForTesting() const; |
| 150 DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const; | 158 DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const; |
| 159 views::Checkbox* GetCheckboxForTesting() const; |
| 160 int GetIndexOfSourceTypeForTesting( |
| 161 content::DesktopMediaID::Type source_type) const; |
| 162 views::TabbedPane* GetPaneForTesting() const; |
| 151 | 163 |
| 152 private: | 164 private: |
| 165 void SwitchSourceType(int index); |
| 166 |
| 153 DesktopMediaPickerViews* parent_; | 167 DesktopMediaPickerViews* parent_; |
| 154 base::string16 app_name_; | |
| 155 | 168 |
| 156 views::Label* description_label_; | 169 views::Label* description_label_; |
| 157 | 170 |
| 158 // |audio_share_checked_| records whether the user permits audio, when | |
| 159 // |audio_share_checkbox_| is disabled. | |
| 160 views::Checkbox* audio_share_checkbox_; | 171 views::Checkbox* audio_share_checkbox_; |
| 161 bool audio_share_checked_; | |
| 162 | 172 |
| 163 views::ScrollView* sources_scroll_view_; | 173 views::TabbedPane* pane_; |
| 164 DesktopMediaListView* sources_list_view_; | 174 std::vector<DesktopMediaListView*> list_views_; |
| 175 std::vector<content::DesktopMediaID::Type> source_types_; |
| 165 | 176 |
| 166 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView); | 177 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView); |
| 167 }; | 178 }; |
| 168 | 179 |
| 169 // Implementation of DesktopMediaPicker for Views. | 180 // Implementation of DesktopMediaPicker for Views. |
| 170 class DesktopMediaPickerViews : public DesktopMediaPicker { | 181 class DesktopMediaPickerViews : public DesktopMediaPicker { |
| 171 public: | 182 public: |
| 172 DesktopMediaPickerViews(); | 183 DesktopMediaPickerViews(); |
| 173 ~DesktopMediaPickerViews() override; | 184 ~DesktopMediaPickerViews() override; |
| 174 | 185 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 194 DoneCallback callback_; | 205 DoneCallback callback_; |
| 195 | 206 |
| 196 // The |dialog_| is owned by the corresponding views::Widget instance. | 207 // The |dialog_| is owned by the corresponding views::Widget instance. |
| 197 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed | 208 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed |
| 198 // asynchronously by closing the widget. | 209 // asynchronously by closing the widget. |
| 199 DesktopMediaPickerDialogView* dialog_; | 210 DesktopMediaPickerDialogView* dialog_; |
| 200 | 211 |
| 201 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); | 212 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); |
| 202 }; | 213 }; |
| 203 | 214 |
| 204 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 215 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
| OLD | NEW |