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

Side by Side Diff: chrome/browser/ui/views/desktop_media_picker_views.h

Issue 1909663004: Desktop Capture Picker New UI: Non Mac Structure Change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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
OLDNEW
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/controls/button/button.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;
16 class Checkbox; 18 class Checkbox;
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,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ButtonListener {
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 // Called by clicking label buttons.
139 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
140
135 // views::View overrides. 141 // views::View overrides.
136 gfx::Size GetPreferredSize() const override; 142 gfx::Size GetPreferredSize() const override;
143 void Layout() override;
137 144
138 // views::DialogDelegateView overrides. 145 // views::DialogDelegateView overrides.
139 ui::ModalType GetModalType() const override; 146 ui::ModalType GetModalType() const override;
140 base::string16 GetWindowTitle() const override; 147 base::string16 GetWindowTitle() const override;
141 bool IsDialogButtonEnabled(ui::DialogButton button) const override; 148 bool IsDialogButtonEnabled(ui::DialogButton button) const override;
142 views::View* GetInitiallyFocusedView() override; 149 views::View* GetInitiallyFocusedView() override;
143 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 150 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
151 bool ShouldDefaultButtonBeBlue() const 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 views::LabelButton* GetSourceTypeButtonForTesting(
161 content::DesktopMediaID::Type source_type) const;
151 162
152 private: 163 private:
164 void SwitchSourceType(int index);
153 DesktopMediaPickerViews* parent_; 165 DesktopMediaPickerViews* parent_;
154 base::string16 app_name_; 166 base::string16 app_name_;
155 167
156 views::Label* description_label_; 168 views::Label* description_label_;
157 169
158 // |audio_share_checked_| records whether the user permits audio, when
159 // |audio_share_checkbox_| is disabled.
160 views::Checkbox* audio_share_checkbox_; 170 views::Checkbox* audio_share_checkbox_;
161 bool audio_share_checked_;
162 171
163 views::ScrollView* sources_scroll_view_; 172 std::vector<views::LabelButton*> source_type_buttons_;
164 DesktopMediaListView* sources_list_view_; 173 std::vector<views::ScrollView*> scroll_views_;
174 std::vector<DesktopMediaListView*> list_views_;
175 std::vector<content::DesktopMediaID::Type> source_types_;
176 int current_index_;
msw 2016/04/22 22:19:56 nit: current index of what? Maybe |current_source_
165 177
166 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView); 178 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView);
167 }; 179 };
168 180
169 // Implementation of DesktopMediaPicker for Views. 181 // Implementation of DesktopMediaPicker for Views.
170 class DesktopMediaPickerViews : public DesktopMediaPicker { 182 class DesktopMediaPickerViews : public DesktopMediaPicker {
171 public: 183 public:
172 DesktopMediaPickerViews(); 184 DesktopMediaPickerViews();
173 ~DesktopMediaPickerViews() override; 185 ~DesktopMediaPickerViews() override;
174 186
(...skipping 20 matching lines...) Expand all
195 207
196 // The |dialog_| is owned by the corresponding views::Widget instance. 208 // The |dialog_| is owned by the corresponding views::Widget instance.
197 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed 209 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed
198 // asynchronously by closing the widget. 210 // asynchronously by closing the widget.
199 DesktopMediaPickerDialogView* dialog_; 211 DesktopMediaPickerDialogView* dialog_;
200 212
201 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); 213 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews);
202 }; 214 };
203 215
204 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ 216 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698