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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
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_
7
8 #include "content/public/browser/desktop_media_id.h"
9 #include "ui/views/view.h"
10
11 namespace views {
12 class ImageView;
13 class Label;
14 } // namespace views
15
16 class DesktopMediaListView;
17
18 // View used for each item in DesktopMediaListView. Shows a single desktop media
19 // source as a thumbnail with the title under it.
20 class DesktopMediaSourceView : public views::View {
21 public:
22 DesktopMediaSourceView(DesktopMediaListView* parent,
23 content::DesktopMediaID source_id);
24 ~DesktopMediaSourceView() override;
25
26 // Updates thumbnail and title from |source|.
27 void SetName(const base::string16& name);
28 void SetThumbnail(const gfx::ImageSkia& thumbnail);
29
30 // Id for the source shown by this View.
31 const content::DesktopMediaID& source_id() const { return source_id_; }
32
33 // Returns true if the source is selected.
34 bool is_selected() const { return selected_; }
35
36 // views::View interface.
37 const char* GetClassName() const override;
38 void Layout() override;
39 views::View* GetSelectedViewForGroup(int group) override;
40 bool IsGroupFocusTraversable() const override;
41 void OnPaint(gfx::Canvas* canvas) override;
42 void OnFocus() override;
43 void OnBlur() override;
44 bool OnMousePressed(const ui::MouseEvent& event) override;
45 void OnGestureEvent(ui::GestureEvent* event) override;
46
47 static const char* kDesktopMediaSourceViewClassName;
48
49 private:
50 // Updates selection state of the element. If |selected| is true then also
51 // calls SetSelected(false) for the source view that was selected before that
52 // (if any).
53 void SetSelected(bool selected);
54
55 DesktopMediaListView* parent_;
56 content::DesktopMediaID source_id_;
57
58 views::ImageView* image_view_;
59 views::Label* label_;
60
61 bool selected_;
62
63 DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView);
64 };
65
66 #endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_CAPTURE_DESKTOP_MEDIA_SOURCE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698