OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ |
7 | 7 |
8 #include "content/public/browser/desktop_media_id.h" | 8 #include "content/public/browser/desktop_media_id.h" |
9 #include "ui/gfx/text_constants.h" | 9 #include "ui/gfx/text_constants.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 class ImageView; | 13 class ImageView; |
14 class Label; | 14 class Label; |
15 } // namespace views | 15 } // namespace views |
16 | 16 |
17 class DesktopMediaListView; | 17 class DesktopMediaListView; |
18 | 18 |
19 // Controls the appearance of DesktopMediaSourceView. | 19 // Controls the appearance of DesktopMediaSourceView. |
20 struct DesktopMediaSourceViewStyle { | 20 struct DesktopMediaSourceViewStyle { |
21 DesktopMediaSourceViewStyle(const DesktopMediaSourceViewStyle& style); | 21 DesktopMediaSourceViewStyle(const DesktopMediaSourceViewStyle& style); |
22 DesktopMediaSourceViewStyle(int columns, | 22 DesktopMediaSourceViewStyle(int columns, |
23 const gfx::Size& item_size, | 23 const gfx::Size& item_size, |
24 const gfx::Rect& icon_rect, | |
24 const gfx::Rect& label_rect, | 25 const gfx::Rect& label_rect, |
25 gfx::HorizontalAlignment text_alignment, | 26 gfx::HorizontalAlignment text_alignment, |
26 const gfx::Rect& image_rect, | 27 const gfx::Rect& image_rect, |
27 int selection_border_thickness, | 28 int selection_border_thickness, |
28 int focus_rectangle_inset); | 29 int focus_rectangle_inset); |
29 | 30 |
30 int columns; | 31 int columns; |
sky
2016/08/25 15:44:51
These might mean something to you, but as someone
qiangchen
2016/08/25 17:07:59
Done.
| |
31 | 32 |
32 gfx::Size item_size; | 33 gfx::Size item_size; |
33 | 34 |
35 gfx::Rect icon_rect; | |
34 gfx::Rect label_rect; | 36 gfx::Rect label_rect; |
35 gfx::HorizontalAlignment text_alignment; | 37 gfx::HorizontalAlignment text_alignment; |
36 | 38 |
37 gfx::Rect image_rect; | 39 gfx::Rect image_rect; |
38 int selection_border_thickness; | 40 int selection_border_thickness; |
39 | 41 |
40 int focus_rectangle_inset; | 42 int focus_rectangle_inset; |
41 }; | 43 }; |
42 | 44 |
43 // View used for each item in DesktopMediaListView. Shows a single desktop media | 45 // View used for each item in DesktopMediaListView. Shows a single desktop media |
44 // source as a thumbnail with the title under it. | 46 // source as a thumbnail with the title under it. |
45 class DesktopMediaSourceView : public views::View { | 47 class DesktopMediaSourceView : public views::View { |
46 public: | 48 public: |
47 DesktopMediaSourceView(DesktopMediaListView* parent, | 49 DesktopMediaSourceView(DesktopMediaListView* parent, |
48 content::DesktopMediaID source_id, | 50 content::DesktopMediaID source_id, |
49 DesktopMediaSourceViewStyle style); | 51 DesktopMediaSourceViewStyle style); |
50 ~DesktopMediaSourceView() override; | 52 ~DesktopMediaSourceView() override; |
51 | 53 |
52 // Used to update the style when the number of available items changes. | 54 // Used to update the style when the number of available items changes. |
53 void SetStyle(DesktopMediaSourceViewStyle style); | 55 void SetStyle(DesktopMediaSourceViewStyle style); |
54 | 56 |
55 // Updates thumbnail and title from |source|. | 57 // Updates thumbnail and title from |source|. |
56 void SetName(const base::string16& name); | 58 void SetName(const base::string16& name); |
57 void SetThumbnail(const gfx::ImageSkia& thumbnail); | 59 void SetThumbnail(const gfx::ImageSkia& thumbnail); |
60 void SetIcon(const gfx::ImageSkia& icon); | |
58 | 61 |
59 // Id for the source shown by this View. | 62 // Id for the source shown by this View. |
60 const content::DesktopMediaID& source_id() const { return source_id_; } | 63 const content::DesktopMediaID& source_id() const { return source_id_; } |
61 | 64 |
62 // Returns true if the source is selected. | 65 // Returns true if the source is selected. |
63 bool is_selected() const { return selected_; } | 66 bool is_selected() const { return selected_; } |
64 | 67 |
65 // views::View interface. | 68 // views::View interface. |
66 const char* GetClassName() const override; | 69 const char* GetClassName() const override; |
67 views::View* GetSelectedViewForGroup(int group) override; | 70 views::View* GetSelectedViewForGroup(int group) override; |
(...skipping 14 matching lines...) Expand all Loading... | |
82 // (if any). | 85 // (if any). |
83 void SetSelected(bool selected); | 86 void SetSelected(bool selected); |
84 | 87 |
85 // Updates hover state of the element, and the appearance. | 88 // Updates hover state of the element, and the appearance. |
86 void SetHovered(bool hovered); | 89 void SetHovered(bool hovered); |
87 | 90 |
88 DesktopMediaListView* parent_; | 91 DesktopMediaListView* parent_; |
89 content::DesktopMediaID source_id_; | 92 content::DesktopMediaID source_id_; |
90 | 93 |
91 DesktopMediaSourceViewStyle style_; | 94 DesktopMediaSourceViewStyle style_; |
95 views::ImageView* icon_view_; | |
92 views::ImageView* image_view_; | 96 views::ImageView* image_view_; |
93 views::Label* label_; | 97 views::Label* label_; |
94 | 98 |
95 bool selected_; | 99 bool selected_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView); | 101 DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView); |
98 }; | 102 }; |
99 | 103 |
100 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ | 104 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ |
OLD | NEW |