Chromium Code Reviews| Index: chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h |
| diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h b/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h |
| index 8c8867f84589f1356bdb0caddb9edd12de415b07..a2a6ceb4bec014b9463dec27c94182f9bd4ab9d5 100644 |
| --- a/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h |
| +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h |
| @@ -6,6 +6,7 @@ |
| #define CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_ |
| #include "content/public/browser/desktop_media_id.h" |
| +#include "ui/gfx/text_constants.h" |
| #include "ui/views/view.h" |
| namespace views { |
| @@ -15,14 +16,42 @@ class Label; |
| class DesktopMediaListView; |
| +// Controls the appearance of DesktopMediaSourceView. |
| +struct DesktopMediaSourceViewStyle { |
| + DesktopMediaSourceViewStyle(const DesktopMediaSourceViewStyle& style); |
| + DesktopMediaSourceViewStyle(int columns, |
| + const gfx::Size& item_size, |
| + const gfx::Rect& label_rect, |
| + gfx::HorizontalAlignment text_alignment, |
| + const gfx::Rect& image_rect, |
| + int selection_border_thickness, |
| + int focus_rectangle_inset); |
| + |
| + int columns; |
| + |
| + gfx::Size item_size; |
| + |
| + gfx::Rect label_rect; |
| + gfx::HorizontalAlignment text_alignment; |
| + |
| + gfx::Rect image_rect; |
| + int selection_border_thickness; |
| + |
| + int focus_rectangle_inset; |
| +}; |
| + |
| // View used for each item in DesktopMediaListView. Shows a single desktop media |
| // source as a thumbnail with the title under it. |
| class DesktopMediaSourceView : public views::View { |
| public: |
| DesktopMediaSourceView(DesktopMediaListView* parent, |
| - content::DesktopMediaID source_id); |
| + content::DesktopMediaID source_id, |
| + DesktopMediaSourceViewStyle style); |
| ~DesktopMediaSourceView() override; |
| + // Used to update the style when the number of available items changes. |
| + void set_style(DesktopMediaSourceViewStyle style) { style_ = style; } |
| + |
| // Updates thumbnail and title from |source|. |
| void SetName(const base::string16& name); |
| void SetThumbnail(const gfx::ImageSkia& thumbnail); |
| @@ -42,6 +71,8 @@ class DesktopMediaSourceView : public views::View { |
| void OnFocus() override; |
| void OnBlur() override; |
| bool OnMousePressed(const ui::MouseEvent& event) override; |
| + void OnMouseEntered(const ui::MouseEvent& event) override; |
| + void OnMouseExited(const ui::MouseEvent& event) override; |
| void OnGestureEvent(ui::GestureEvent* event) override; |
| static const char* kDesktopMediaSourceViewClassName; |
| @@ -52,13 +83,18 @@ class DesktopMediaSourceView : public views::View { |
| // (if any). |
| void SetSelected(bool selected); |
| + // Updates hover state of the element, and the appearance. |
| + void SetHovered(bool hovered); |
| + |
| DesktopMediaListView* parent_; |
| content::DesktopMediaID source_id_; |
| + DesktopMediaSourceViewStyle style_; |
| views::ImageView* image_view_; |
| views::Label* label_; |
| bool selected_; |
| + bool hovered_; |
|
msw
2016/05/25 17:22:13
Remove |hovered_| now that it's unused.
qiangchen
2016/05/25 20:27:30
Done.
|
| DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView); |
| }; |