OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" | |
12 #include "ui/views/window/dialog_delegate.h" | |
13 | |
14 class ConstrainedWindowViews; | |
15 | |
16 namespace views { | |
17 class Checkbox; | |
18 } | |
19 | |
20 namespace chrome { | |
21 | |
22 // The media galleries configuration view for Gtk. It will immediately show | |
Peter Kasting
2012/08/11 23:09:14
Gtk?
Evan Stade
2012/08/13 23:10:30
Done.
| |
23 // upon construction. | |
24 class MediaGalleriesDialogViews : public MediaGalleriesDialog, | |
25 public views::DialogDelegate, | |
26 public views::ButtonListener { | |
27 public: | |
28 explicit MediaGalleriesDialogViews( | |
29 MediaGalleriesDialogController* controller); | |
30 virtual ~MediaGalleriesDialogViews(); | |
31 | |
32 // MediaGalleriesDialog implementation: | |
33 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, | |
34 bool permitted) OVERRIDE; | |
35 | |
36 // views::DialogDelegate implementation: | |
37 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | |
38 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | |
39 virtual bool Cancel() OVERRIDE; | |
40 virtual bool Accept() OVERRIDE; | |
41 | |
42 // views::WidgetDelegate implementation: | |
Peter Kasting
2012/08/11 23:09:14
Nit: This class doesn't directly inherit from Widg
Evan Stade
2012/08/13 23:10:30
Done.
| |
43 virtual views::View* GetContentsView() OVERRIDE; | |
44 virtual views::Widget* GetWidget() OVERRIDE; | |
45 virtual const views::Widget* GetWidget() const OVERRIDE; | |
46 virtual void DeleteDelegate() OVERRIDE; | |
47 | |
48 // views::ButtonListener implementation: | |
49 virtual void ButtonPressed( | |
50 views::Button* sender, const ui::Event& event) OVERRIDE; | |
Peter Kasting
2012/08/11 23:09:14
Nit: First arg on previous line
Evan Stade
2012/08/13 23:10:30
Done.
| |
51 | |
52 private: | |
53 typedef std::map<const MediaGalleryPrefInfo*, views::Checkbox*> CheckboxMap; | |
54 | |
55 void InitChildViews(); | |
56 | |
57 // Adds a checkbox or updates an existing checkbox. Returns true if a new one | |
58 // was added. | |
59 bool AddOrUpdateGallery(const MediaGalleryPrefInfo* gallery, | |
60 bool permitted); | |
61 | |
62 // Enables the confirm button (see |confirm_available_|). | |
63 void EnableConfirm(); | |
64 | |
65 MediaGalleriesDialogController* controller_; | |
66 | |
Peter Kasting
2012/08/11 23:09:14
Nit: No need for blank lines for members without c
Evan Stade
2012/08/13 23:10:30
I originally did not document that because it is d
Peter Kasting
2012/08/14 18:44:01
I read constrained_window_views.h but it doesn't s
| |
67 ConstrainedWindowViews* window_; | |
68 | |
69 views::View* contents_; | |
70 | |
71 views::View* checkbox_container_; | |
72 | |
73 // A map from media gallery to views::Checkbox view. | |
74 CheckboxMap checkbox_map_; | |
75 | |
76 views::Button* add_gallery_; | |
77 | |
78 // This tracks whether the confirm button can be clicked. It starts as false | |
79 // if no checkboxes are ticked. After there is any interaction, or some | |
80 // checkboxes start checked, this will be true. | |
81 bool confirm_available_; | |
82 | |
83 // True if the user has pressed accept. | |
84 bool accepted_; | |
85 | |
86 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); | |
87 }; | |
88 | |
89 } // namespace chrome | |
90 | |
91 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | |
OLD | NEW |