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