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

Unified Diff: chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h

Issue 1990053002: Desktop Capture Picker New UI: Non Mac Appearance Change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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..7ea565dd25361a86680a4e9abdb4b00125571bf1 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 SetStyle(DesktopMediaSourceViewStyle style);
+
// Updates thumbnail and title from |source|.
void SetName(const base::string16& name);
void SetThumbnail(const gfx::ImageSkia& thumbnail);
@@ -35,13 +64,14 @@ class DesktopMediaSourceView : public views::View {
// views::View interface.
const char* GetClassName() const override;
- void Layout() override;
views::View* GetSelectedViewForGroup(int group) override;
bool IsGroupFocusTraversable() const override;
void OnPaint(gfx::Canvas* canvas) override;
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,9 +82,13 @@ 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_;

Powered by Google App Engine
This is Rietveld 408576698