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

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

Issue 1978633002: Desktop Capture Picker New UI: Split File (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unittest 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
new file mode 100644
index 0000000000000000000000000000000000000000..8c8867f84589f1356bdb0caddb9edd12de415b07
--- /dev/null
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h
@@ -0,0 +1,66 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_
+
+#include "content/public/browser/desktop_media_id.h"
+#include "ui/views/view.h"
+
+namespace views {
+class ImageView;
+class Label;
+} // namespace views
+
+class DesktopMediaListView;
+
+// 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);
+ ~DesktopMediaSourceView() override;
+
+ // Updates thumbnail and title from |source|.
+ void SetName(const base::string16& name);
+ void SetThumbnail(const gfx::ImageSkia& thumbnail);
+
+ // Id for the source shown by this View.
+ const content::DesktopMediaID& source_id() const { return source_id_; }
+
+ // Returns true if the source is selected.
+ bool is_selected() const { return selected_; }
+
+ // 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 OnGestureEvent(ui::GestureEvent* event) override;
+
+ static const char* kDesktopMediaSourceViewClassName;
+
+ private:
+ // Updates selection state of the element. If |selected| is true then also
+ // calls SetSelected(false) for the source view that was selected before that
+ // (if any).
+ void SetSelected(bool selected);
+
+ DesktopMediaListView* parent_;
+ content::DesktopMediaID source_id_;
+
+ views::ImageView* image_view_;
+ views::Label* label_;
+
+ bool selected_;
+
+ DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698