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 "chrome/browser/media/desktop_media_list_observer.h" | 8 #include "chrome/browser/media/desktop_media_list_observer.h" |
9 #include "chrome/browser/media/desktop_media_picker.h" | 9 #include "chrome/browser/media/desktop_media_picker.h" |
10 #include "ui/views/window/dialog_delegate.h" | 10 #include "ui/views/window/dialog_delegate.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Called by DesktopMediaSourceView when selection has changed. | 32 // Called by DesktopMediaSourceView when selection has changed. |
33 void OnSelectionChanged(); | 33 void OnSelectionChanged(); |
34 | 34 |
35 // Called by DesktopMediaSourceView when a source has been double-clicked. | 35 // Called by DesktopMediaSourceView when a source has been double-clicked. |
36 void OnDoubleClick(); | 36 void OnDoubleClick(); |
37 | 37 |
38 // Returns currently selected source. | 38 // Returns currently selected source. |
39 DesktopMediaSourceView* GetSelection(); | 39 DesktopMediaSourceView* GetSelection(); |
40 | 40 |
41 // views::View overrides. | 41 // views::View overrides. |
42 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 42 virtual gfx::Size GetPreferredSize() const override; |
43 virtual void Layout() OVERRIDE; | 43 virtual void Layout() override; |
44 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 44 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
45 | 45 |
46 private: | 46 private: |
47 // DesktopMediaList::Observer interface | 47 // DesktopMediaList::Observer interface |
48 virtual void OnSourceAdded(int index) OVERRIDE; | 48 virtual void OnSourceAdded(int index) override; |
49 virtual void OnSourceRemoved(int index) OVERRIDE; | 49 virtual void OnSourceRemoved(int index) override; |
50 virtual void OnSourceMoved(int old_index, int new_index) OVERRIDE; | 50 virtual void OnSourceMoved(int old_index, int new_index) override; |
51 virtual void OnSourceNameChanged(int index) OVERRIDE; | 51 virtual void OnSourceNameChanged(int index) override; |
52 virtual void OnSourceThumbnailChanged(int index) OVERRIDE; | 52 virtual void OnSourceThumbnailChanged(int index) override; |
53 | 53 |
54 // Accepts whatever happens to be selected right now. | 54 // Accepts whatever happens to be selected right now. |
55 void AcceptSelection(); | 55 void AcceptSelection(); |
56 | 56 |
57 DesktopMediaPickerDialogView* parent_; | 57 DesktopMediaPickerDialogView* parent_; |
58 scoped_ptr<DesktopMediaList> media_list_; | 58 scoped_ptr<DesktopMediaList> media_list_; |
59 base::WeakPtrFactory<DesktopMediaListView> weak_factory_; | 59 base::WeakPtrFactory<DesktopMediaListView> weak_factory_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListView); | 61 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListView); |
62 }; | 62 }; |
(...skipping 10 matching lines...) Expand all Loading... |
73 void SetName(const base::string16& name); | 73 void SetName(const base::string16& name); |
74 void SetThumbnail(const gfx::ImageSkia& thumbnail); | 74 void SetThumbnail(const gfx::ImageSkia& thumbnail); |
75 | 75 |
76 // Id for the source shown by this View. | 76 // Id for the source shown by this View. |
77 const content::DesktopMediaID& source_id() const { return source_id_; } | 77 const content::DesktopMediaID& source_id() const { return source_id_; } |
78 | 78 |
79 // Returns true if the source is selected. | 79 // Returns true if the source is selected. |
80 bool is_selected() const { return selected_; } | 80 bool is_selected() const { return selected_; } |
81 | 81 |
82 // views::View interface. | 82 // views::View interface. |
83 virtual const char* GetClassName() const OVERRIDE; | 83 virtual const char* GetClassName() const override; |
84 virtual void Layout() OVERRIDE; | 84 virtual void Layout() override; |
85 virtual views::View* GetSelectedViewForGroup(int group) OVERRIDE; | 85 virtual views::View* GetSelectedViewForGroup(int group) override; |
86 virtual bool IsGroupFocusTraversable() const OVERRIDE; | 86 virtual bool IsGroupFocusTraversable() const override; |
87 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 87 virtual void OnPaint(gfx::Canvas* canvas) override; |
88 virtual void OnFocus() OVERRIDE; | 88 virtual void OnFocus() override; |
89 virtual void OnBlur() OVERRIDE; | 89 virtual void OnBlur() override; |
90 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 90 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
91 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 91 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
92 | 92 |
93 private: | 93 private: |
94 // Updates selection state of the element. If |selected| is true then also | 94 // Updates selection state of the element. If |selected| is true then also |
95 // calls SetSelected(false) for the source view that was selected before that | 95 // calls SetSelected(false) for the source view that was selected before that |
96 // (if any). | 96 // (if any). |
97 void SetSelected(bool selected); | 97 void SetSelected(bool selected); |
98 | 98 |
99 DesktopMediaListView* parent_; | 99 DesktopMediaListView* parent_; |
100 content::DesktopMediaID source_id_; | 100 content::DesktopMediaID source_id_; |
101 | 101 |
(...skipping 17 matching lines...) Expand all Loading... |
119 virtual ~DesktopMediaPickerDialogView(); | 119 virtual ~DesktopMediaPickerDialogView(); |
120 | 120 |
121 // Called by parent (DesktopMediaPickerViews) when it's destroyed. | 121 // Called by parent (DesktopMediaPickerViews) when it's destroyed. |
122 void DetachParent(); | 122 void DetachParent(); |
123 | 123 |
124 // Called by DesktopMediaListView. | 124 // Called by DesktopMediaListView. |
125 void OnSelectionChanged(); | 125 void OnSelectionChanged(); |
126 void OnDoubleClick(); | 126 void OnDoubleClick(); |
127 | 127 |
128 // views::View overrides. | 128 // views::View overrides. |
129 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 129 virtual gfx::Size GetPreferredSize() const override; |
130 virtual void Layout() OVERRIDE; | 130 virtual void Layout() override; |
131 | 131 |
132 // views::DialogDelegateView overrides. | 132 // views::DialogDelegateView overrides. |
133 virtual ui::ModalType GetModalType() const OVERRIDE; | 133 virtual ui::ModalType GetModalType() const override; |
134 virtual base::string16 GetWindowTitle() const OVERRIDE; | 134 virtual base::string16 GetWindowTitle() const override; |
135 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 135 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
136 virtual base::string16 GetDialogButtonLabel( | 136 virtual base::string16 GetDialogButtonLabel( |
137 ui::DialogButton button) const OVERRIDE; | 137 ui::DialogButton button) const override; |
138 virtual bool Accept() OVERRIDE; | 138 virtual bool Accept() override; |
139 virtual void DeleteDelegate() OVERRIDE; | 139 virtual void DeleteDelegate() override; |
140 | 140 |
141 void OnMediaListRowsChanged(); | 141 void OnMediaListRowsChanged(); |
142 | 142 |
143 DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const; | 143 DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const; |
144 | 144 |
145 private: | 145 private: |
146 DesktopMediaPickerViews* parent_; | 146 DesktopMediaPickerViews* parent_; |
147 base::string16 app_name_; | 147 base::string16 app_name_; |
148 | 148 |
149 views::Label* label_; | 149 views::Label* label_; |
(...skipping 11 matching lines...) Expand all Loading... |
161 | 161 |
162 void NotifyDialogResult(content::DesktopMediaID source); | 162 void NotifyDialogResult(content::DesktopMediaID source); |
163 | 163 |
164 // DesktopMediaPicker overrides. | 164 // DesktopMediaPicker overrides. |
165 virtual void Show(content::WebContents* web_contents, | 165 virtual void Show(content::WebContents* web_contents, |
166 gfx::NativeWindow context, | 166 gfx::NativeWindow context, |
167 gfx::NativeWindow parent, | 167 gfx::NativeWindow parent, |
168 const base::string16& app_name, | 168 const base::string16& app_name, |
169 const base::string16& target_name, | 169 const base::string16& target_name, |
170 scoped_ptr<DesktopMediaList> media_list, | 170 scoped_ptr<DesktopMediaList> media_list, |
171 const DoneCallback& done_callback) OVERRIDE; | 171 const DoneCallback& done_callback) override; |
172 | 172 |
173 DesktopMediaPickerDialogView* GetDialogViewForTesting() const { | 173 DesktopMediaPickerDialogView* GetDialogViewForTesting() const { |
174 return dialog_; | 174 return dialog_; |
175 } | 175 } |
176 | 176 |
177 private: | 177 private: |
178 DoneCallback callback_; | 178 DoneCallback callback_; |
179 | 179 |
180 // The |dialog_| is owned by the corresponding views::Widget instance. | 180 // The |dialog_| is owned by the corresponding views::Widget instance. |
181 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed | 181 // When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed |
182 // asynchronously by closing the widget. | 182 // asynchronously by closing the widget. |
183 DesktopMediaPickerDialogView* dialog_; | 183 DesktopMediaPickerDialogView* dialog_; |
184 | 184 |
185 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); | 185 DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews); |
186 }; | 186 }; |
187 | 187 |
188 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ | 188 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_ |
OLD | NEW |