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

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

Powered by Google App Engine
This is Rietveld 408576698